Xaraya / Postnuke CVS Notices - Message

Note: this list is kept only as a demonstration for CVSNotice. For the latest CVS notices, see the Xaraya and Postnuke sites

View Statistics - Next Notice - Previous Notice

Directory filter : [ all ] / postnuke_official / html / modules / base [ view in CVS ]

Date Directory [filter] File(s) [view] Author [filter]
03 Aug 2002 03:00:15postnuke_official/html/modules/basepninit.php,NONE,1.1Paul Rosania
 pninit.php's for base modules

Update of /home/cvsroot/postnuke_official/html/modules/base
In directory ns7.hostnuke.net:/tmp/cvs-serv31878/base

Added Files:
	pninit.php 
Log Message:
pninit.php's for base modules


--- NEW FILE: pninit.php ---
<?php
// $Id: pninit.php,v 1.1 2002/08/03 03:00:13 paul Exp $
// ----------------------------------------------------------------------
// POST-NUKE Content Management System
// Copyright (C) 2001 by the PostNuke Development Team.
// http://www.postnuke.com/
// ----------------------------------------------------------------------
// Based on:
// PHP-NUKE Web Portal System - http://phpnuke.org/
// Thatware - http://thatware.org/
// ----------------------------------------------------------------------
// LICENSE
//
// This program is free software; you can redistribute it and/or
// modify it under the terms of the GNU General Public License (GPL)
// 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 more details.
//
// To read the license please visit http://www.gnu.org/copyleft/gpl.html
// ----------------------------------------------------------------------
// Original Author of file: Paul Rosania
// Purpose of file:  Initialisation functions for base
// ----------------------------------------------------------------------

/**
 * initialise the base module
 */
function base_init()
{
    // Get database information
    list($dbconn) = pnDBGetConn();
    $pntable = pnDBGetTables();
    $prefix = pnConfigGetVar('prefix');

    // Create tables
    
    // *_hooks
    $query = pnDBCreateTable($prefix . '_hooks',
                             array('pn_id'      => array('type'        => 'integer',
                                                         'unsigned'    => true,
                                                         'null'        => false,
                                                         'default'     => '0',
                                                         'increment'   => true,
                                                         'primary_key' => true),
                                   'pn_object'  => array('type'     => 'varchar',
                                                         'size'     => 64,
                                                         'null'     => false,
                                                         'default'  => ''),
                                   'pn_action'  => array('type'     => 'varchar',
                                                         'size'     => 64,
                                                         'null'     => false,
                                                         'default'  => ''),
                                   'pn_smodule' => array('type'     => 'varchar',
                                                         'size'     => 64,
                                                         'default'  => NULL),
                                   'pn_stype'   => array('type'     => 'varchar',
                                                         'size'     => 64,
                                                         'default'  => NULL),
                                   'pn_tarea'   => array('type'     => 'varchar',
                                                         'size'     => 64,
                                                         'null'     => false,
                                                         'default'  => ''),
                                   'pn_tmodule' => array('type'     => 'varchar',
                                                         'size'     => 64,
                                                         'null'     => false,
                                                         'default'  => ''),
                                   'pn_ttype'   => array('type'     => 'varchar',
                                                         'size'     => 64,
                                                         'null'     => false,
                                                         'default'  => ''),
                                   'pn_tfunc'   => array('type'     => 'varchar',
                                                         'size'     => 64,
                                                         'null'     => false,
                                                         'default'  => '')));
    $dbconn->Execute($query);
    
    // Check for db errors
    if ($dbconn->ErrorNo() != 0) {
        $msg = pnMLByKey('DATABASE_ERROR', $query);
        pnExceptionSet(PN_SYSTEM_EXCEPTION, 'DATABASE_ERROR',
                       new SystemException(__FILE__.'('.__LINE__.'): '.$msg));
        return NULL;
    }
    
    // *_module_vars
    $query = pnDBCreateTable($prefix . '_module_vars',
                             array('pn_id'      => array('type'        => 'integer',
                                                         'null'        => false,
                                                         'default'     => '0',
                                                         'increment'   => true,
                                                         'primary_key' => true),
                                   'pn_modname' => array('type'    => 'varchar',
                                                         'size'    => 64,
                                                         'null'    => false,
                                                         'default' => ''),
                                   'pn_name'    => array('type'    => 'varchar',
                                                         'size'    => 64,
                                                         'null'    => false,
                                                         'default' => ''),
                                   'pn_value'   => array('type'    => 'text',
                                                         'size'    => 'long')));
    $dbconn->Execute($query);
       
    // Check for db errors
    if ($dbconn->ErrorNo() != 0) {
        $msg = pnMLByKey('DATABASE_ERROR', $query);
        pnExceptionSet(PN_SYSTEM_EXCEPTION, 'DATABASE_ERROR',
                       new SystemException(__FILE__.'('.__LINE__.'): '.$msg));
        return NULL;
    }
    
    // *_session_info
    $query = pnDBCreateTable($prefix . '_session_info',
                             array('pn_sessid'    => array('type'        => 'varchar',
                                                           'size'        => 32,
                                                           'null'        => false,
                                                           'default'     => '',
                                                           'primary_key' => true),
                                   'pn_ipaddr'    => array('type'     => 'varchar',
                                                           'size'     => 20,
                                                           'null'     => false,
                                                           'default'  => ''),
                                   'pn_firstused' => array('type'     => 'integer',
                                                           'null'     => false,
                                                           'default'  => '0'),
                                   'pn_lastused'  => array('type'     => 'integer',
                                                           'null'     => false,
                                                           'default'  => '0'),
                                   'pn_uid'       => array('type'     => 'integer',
                                                           'null'     => false,
                                                           'default'  => '0'),
                                   'pn_vars'      => array('type'     => 'blob')));
    $dbconn->Execute($query);echo $query;
    
    // Check for db errors
    if ($dbconn->ErrorNo() != 0) {
        $msg = pnMLByKey('DATABASE_ERROR', $query);
        pnExceptionSet(PN_SYSTEM_EXCEPTION, 'DATABASE_ERROR',
                       new SystemException(__FILE__.'('.__LINE__.'): '.$msg));
        return NULL;
    }
    
    // *_template_tags
    $query = pnDBCreateTable($prefix . '_template_tags',
                             array('pn_id'      => array('type'        => 'integer',
                                                         'null'        => false,
                                                         'default'     => '0',
                                                         'increment'   => true,
                                                         'primary_key' => true),
                                   'pn_name'    => array('type'    => 'varchar',
                                                         'size'    => 255,
                                                         'null'    => false,
                                                         'default' => ''),
                                   'pn_module'  => array('type'    => 'varchar',
                                                         'size'    => 255,
                                                         'default' => NULL),
                                   'pn_handler' => array('type'    => 'varchar',
                                                         'size'    => 255,
                                                         'null'    => false,
                                                         'default' => ''),
                                   'pn_data'    => array('type'    => 'text')));
    $dbconn->Execute($query);

    // Check for db errors
    if ($dbconn->ErrorNo() != 0) {
        $msg = pnMLByKey('DATABASE_ERROR', $query);
        pnExceptionSet(PN_SYSTEM_EXCEPTION, 'DATABASE_ERROR',
                       new SystemException(__FILE__.'('.__LINE__.'): '.$msg));
        return NULL;
    }
    
    // *_modules
    $query = pnDBCreateTable($prefix. '_modules',
                             array('pn_id'            => array('type'        => 'integer',
                                                               'null'        => false,
                                                               'default'     => '0',
                                                               'increment'   => true,
                                                               'primary_key' => true),
                                   'pn_name'          => array('type'    => 'varchar',
                                                               'size'    => 64,
                                                               'null'    => false,
                                                               'default' => ''),
                                   'pn_type'          => array('type'     => 'integer',
                                                               'null'     => false,
                                                               'default'  => '0'),
                                   'pn_displayname'   => array('type'    => 'varchar',
                                                               'size'    => 64,
                                                               'null'    => false,
                                                               'default' => ''),
                                   'pn_description'   => array('type'    => 'varchar',
                                                               'size'    => 255,
                                                               'null'    => false,
                                                               'default' => ''),
                                   'pn_regid'         => array('type'    => 'integer',
                                                               'unsigned'=> true,
                                                               'null'    => false,
                                                               'default' => '0'),
                                   'pn_directory'     => array('type'    => 'varchar',
                                                               'size'    => 64,
                                                               'null'    => false,
                                                               'default' => ''),
                                   'pn_version'       => array('type'    => 'varchar',
                                                               'size'    => 10,
                                                               'null'    => false,
                                                               'default' => '0'),
                                   'pn_admin_capable' => array('type'     => 'integer',
                                                               'size'     => 'tiny',
                                                               'null'     => false,
                                                               'default'  => '0'),
                                   'pn_user_capable'  => array('type'     => 'integer',
                                                               'size'     => 'tiny',
                                                               'null'     => false,
                                                               'default'  => '0'),
                                   'pn_state'         => array('type'     => 'integer',
                                                               'size'     => 'tiny',
                                                               'null'     => false,
                                                               'default'  => '0')));
    $dbconn->Execute($query);

    // Check for db errors
    if ($dbconn->ErrorNo() != 0) {
        $msg = pnMLByKey('DATABASE_ERROR', $query);
        pnExceptionSet(PN_SYSTEM_EXCEPTION, 'DATABASE_ERROR',
                       new SystemException(__FILE__.'('.__LINE__.'): '.$msg));
        return NULL;
    }
    
    // *_groups
    $query = pnDBCreateTable($prefix . '_groups',
                             array('pn_gid'      => array('type'        => 'integer',
                                                          'null'        => false,
                                                          'default'     => '0',
                                                          'increment'   => true,
                                                          'primary_key' => true),
                                   'pn_name'    => array('type'    => 'varchar',
                                                         'size'    => 255,
                                                         'null'    => false,
                                                         'default' => '')));
    $dbconn->Execute($query);
    
    // Check for db errors
    if ($dbconn->ErrorNo() != 0) {
        $msg = pnMLByKey('DATABASE_ERROR', $query);
        pnExceptionSet(PN_SYSTEM_EXCEPTION, 'DATABASE_ERROR',
                       new SystemException(__FILE__.'('.__LINE__.'): '.$msg));
        return NULL;
    }
    
    // *_group_membership
    $query = pnDBCreateTable($prefix . '_group_membership',
                             array('pn_gid' => array('type'    => 'integer',
                                                     'null'    => false,
                                                     'default' => '0'),
                                   'pn_uid' => array('type'    => 'integer',
                                                     'null'    => false,
                                                     'default' => '0')));
    $dbconn->Execute($query);
    
    // Check for db errors
    if ($dbconn->ErrorNo() != 0) {
        $msg = pnMLByKey('DATABASE_ERROR', $query);
        pnExceptionSet(PN_SYSTEM_EXCEPTION, 'DATABASE_ERROR',
                       new SystemException(__FILE__.'('.__LINE__.'): '.$msg));
        return NULL;
    }
    
    $query = pnDBCreateIndex($prefix . '_group_membership',
                             array('fields' => array('pn_uid', 'pn_gid'),
                                   'unique' => 'true'));
    $dbconn->Execute($query);
    
    // Check for db errors
    if ($dbconn->ErrorNo() != 0) {
        $msg = pnMLByKey('DATABASE_ERROR', $query);
        pnExceptionSet(PN_SYSTEM_EXCEPTION, 'DATABASE_ERROR',
                       new SystemException(__FILE__.'('.__LINE__.'): '.$msg));
        return NULL;
    }
    
    // *_group_perms
    $query = pnDBCreateTable($prefix . '_group_perms',
                             array('pn_pid'      => array('type'        => 'integer',
                                                          'null'        => false,
                                                          'default'     => '0',
                                                          'increment'   => true,
                                                          'primary_key' => true),
                                   'pn_gid'      => array('type'    => 'integer',
                                                          'null'    => false,
                                                          'default' => '0'),
                                   'pn_sequence' => array('type'    => 'integer',
                                                          'null'    => false,
                                                          'default' => '0'),
                                   'pn_realm'    => array('type'    => 'integer',
                                                          'size' => 'small',
                                                          'null'    => false,
                                                          'default' => '0'),
                                   'pn_component'=> array('type'    => 'varchar',
                                                          'size'    => 255,
                                                          'null'    => false,
                                                          'default' => ''),
                                   'pn_instance' => array('type'    => 'varchar',
                                                          'size'    => 255,
                                                          'null'    => false,
                                                          'default' => ''),                                                     
                                   'pn_level'     => array('type'    => 'integer',
                                                           'size' => 'small',
                                                           'null'    => false,
                                                           'default' => '0'),
                                   'pn_bond'      => array('type'    => 'integer',
                                                           'null'    => false,
                                                           'default' => '0')));
    $dbconn->Execute($query);
    
    // Check for db errors
    if ($dbconn->ErrorNo() != 0) {
        $msg = pnMLByKey('DATABASE_ERROR', $query);
        pnExceptionSet(PN_SYSTEM_EXCEPTION, 'DATABASE_ERROR',
                       new SystemException(__FILE__.'('.__LINE__.'): '.$msg));
        return NULL;
    }
    
    // *_realms
    $query = pnDBCreateTable($prefix . '_realms',
                             array('pn_rid'  => array('type'        => 'integer',
                                                      'null'        => false,
                                                      'default'     => '0',
                                                      'increment'   => true,
                                                      'primary_key' => true),
                                   'pn_name' => array('type'    => 'varchar',
                                                      'size'    => 255,
                                                      'null'    => false,
                                                      'default' => '')));
    $dbconn->Execute($query);
    
    // Check for db errors
    if ($dbconn->ErrorNo() != 0) {
        $msg = pnMLByKey('DATABASE_ERROR', $query);
        pnExceptionSet(PN_SYSTEM_EXCEPTION, 'DATABASE_ERROR',
                       new SystemException(__FILE__.'('.__LINE__.'): '.$msg));
        return NULL;
    }
    
    // *_admin_menu
    // *_block_groups
    // *_block_instances
    // *_block_types
    // *_block_group_instances
    // *_users
    // *_user_data
    // *_user_perms
    // *_user_property
    // *_languages (?)
    
    // Set config vars
    
    // Set up default user properties, etc.
    
    // Fill language list
    // Fill admin menu
    // Set up blocks
    
    // Create admin user (l/p: admin/[current day of year(?)])
    
    
    // Register BL tags
    pnTplRegisterTag('base', 'var',
                     array(new pnTemplateAttribute('name', PN_TPL_STRING|PN_TPL_REQUIRED),
                           new pnTemplateAttribute('scope', PN_TPL_STRING|PN_TPL_OPTIONAL)),
                     'base_userapi_handleVarTag');

    pnTplRegisterTag('base', 'block',
                     array(new pnTemplateAttribute('name', PN_TPL_STRING|PN_TPL_REQUIRED),
                           new pnTemplateAttribute('module', PN_TPL_STRING|PN_TPL_REQUIRED),
                           new pnTemplateAttribute('title', PN_TPL_STRING|PN_TPL_OPTIONAL),
                           new pnTemplateAttribute('template', PN_TPL_STRING|PN_TPL_OPTIONAL),
                           new pnTemplateAttribute('type', PN_TPL_STRING|PN_TPL_OPTIONAL)),
                     'base_userapi_handleBlockTag');
         
    pnTplRegisterTag('base', 'blockgroup',
                     array(new pnTemplateAttribute('name', PN_TPL_STRING|PN_TPL_REQUIRED),
                           new pnTemplateAttribute('template', PN_TPL_STRING|PN_TPL_OPTIONAL)),
                     'base_userapi_handleBlockgroupTag');

    pnTplRegisterTag('base', 'module',
                     array(new pnTemplateAttribute('name', PN_TPL_STRING|PN_TPL_OPTIONAL),
                           new pnTemplateAttribute('main', PN_TPL_BOOLEAN|PN_TPL_OPTIONAL)),
                     'base_userapi_handleModuleTag');

    pnTplRegisterTag('base', 'if',
                     array(new pnTemplateAttribute('condition', PN_TPL_STRING|PN_TPL_REQUIRED)),
                     'base_userapi_handleIfTag');

    pnTplRegisterTag('base', 'elseif',
                     array(new pnTemplateAttribute('condition', PN_TPL_STRING|PN_TPL_REQUIRED)),
                     'base_userapi_handleElseifTag');
         
    pnTplRegisterTag('base', 'else', array(), 'base_userapi_handleElseTag');

    pnTplRegisterTag('base', 'loop',
                     array(new pnTemplateAttribute('name', PN_TPL_STRING|PN_TPL_REQUIRED),
                           new pnTemplateAttribute('key', PN_TPL_STRING|PN_TPL_OPTIONAL)),
                     'base_userapi_handleLoopTag');

    pnTplRegisterTag('base', 'set',
                     array(new pnTemplateAttribute('name', PN_TPL_STRING|PN_TPL_REQUIRED),
                           new pnTemplateAttribute('scope', PN_TPL_STRING|PN_TPL_OPTIONAL)),
                     'base_userapi_handleSetTag');

    pnTplRegisterTag('base', 'baseurl',
                     array(),
                	 'base_userapi_handleBaseurlTag');
        
    pnTplRegisterTag('base', 'mlstring',
                     array(new pnTemplateAttribute('name', PN_TPL_STRING|PN_TPL_OPTIONAL)),
                     'base_userapi_handleMlstringTag');
    
    // Initialisation successful
    return true;
}

/**
 * upgrade the base module from an old version
 */
function base_upgrade($oldversion)
{
    return false;
}

/**
 * delete the base module
 */
function base_delete()
{
    return false;
}

?>


Directory filter : [ all ] / postnuke_official / html / modules / base [ view in CVS ]

View Statistics - Next Notice - Previous Notice


Visit Developer Site - Browse CVS Repository Syndicate via backend.rss
(max. once per hour please)
Powered by CVSNotice 0.1.3