1   <?php
  2   /**
  3   * @version      $Id: install.php 13577 2010-05-19 07:24:12Z alex $
  4   * @package      In-Bulletin
  5   * @copyright    Copyright (C) 1997 - 2009 Intechnic. All rights reserved.
  6   * @license      GNU/GPL
  7   * In-Portal is Open Source software.
  8   * This means that this software may have been modified pursuant
  9   * the GNU General Public License, and as distributed it includes
  10   * or is derivative of works licensed under the GNU General Public License
  11   * or other free or open source software licenses.
  12   * See http://www.in-portal.org/license for copyright notices and details.
  13   */
  14           $module_folder = 'modules/in-bulletin';
  15  
  16           if (!defined('IS_INSTALL')) {
  17                   // separate module install
  18                   define('IS_INSTALL', 1);
  19                   define('ADMIN', 1);
  20                   define('REL_PATH', $module_folder);
  21                   define('FULL_PATH', realpath(dirname(__FILE__) . '/../..') );
  22  
  23                   include_once(FULL_PATH . '/core/kernel/startup.php');
  24                   require_once FULL_PATH . '/core/install/install_toolkit.php';
  25  
  26                   $toolkit = new kInstallToolkit();
  27           }
  28           else {
  29                   // install, using installation wizard
  30                   $toolkit =& $this->toolkit;
  31                   /* @var $toolkit kInstallToolkit */
  32           }
  33  
  34           $application =& kApplication::Instance();
  35           $application->Init();
  36  
  37           if ($application->RecallVar('user_id') != USER_ROOT) {
  38                   die('restricted access!');
  39           }
  40  
  41           $category =& $toolkit->createModuleCategory('Forums', 'Discussion Forums', '#in-bulletin/section_design#', 'in-bulletin/img/menu_topics.gif');
  42  
  43           $toolkit->RunSQL('/' . $module_folder . '/install/install_schema.sql');
  44           $toolkit->RunSQL('/' . $module_folder . '/install/install_data.sql', '{TopicCatId}', $category->GetID());
  45           $toolkit->ImportLanguage('/' . $module_folder . '/install/english');
  46  
  47           $toolkit->SetModuleRootCategory(basename($module_folder), $category->GetID());
  48  
  49   //      $toolkit->linkCustomFields(basename($module_folder), 'bb', 3); // to create Custom Fields for Topics
  50           $toolkit->linkCustomFields('KERNEL', 'c', 1); // to create ItemTemplate custom field
  51           $toolkit->setModuleItemTemplate($category, 'bb', '#in-bulletin/item_design#');
  52  
  53           $toolkit->finalizeModuleInstall($module_folder, true);