1   <?php
  2   /**
  3   * @version      $Id: install.php 12802 2009-10-27 16:38:37Z alex $
  4   * @package      In-Link
  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 = 'in-link';
  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') != -1) {
  38                   die('restricted access!');
  39           }
  40  
  41           $category =& $toolkit->createModuleCategory('Directory', 'Link Directory', '#in-link/section_design#', 'in-link/img/menu_links.gif');
  42  
  43           $toolkit->RunSQL('/' . $module_folder . '/install/install_schema.sql');
  44           $toolkit->RunSQL('/' . $module_folder . '/install/install_data.sql', '{LinkCatId}', $category->GetID());
  45           $toolkit->ImportLanguage('/' . $module_folder . '/install/english');
  46  
  47           $toolkit->SetModuleRootCategory($module_folder, $category->GetID());
  48  
  49           $toolkit->linkCustomFields($module_folder, 'l', 4); // to create Custom Fields for Links
  50           $toolkit->linkCustomFields('KERNEL', 'c', 1); // to create ItemTemplate custom field
  51           $toolkit->setModuleItemTemplate($category, 'l', '#in-link/item_design#');
  52  
  53           $toolkit->finalizeModuleInstall($module_folder, true);