Index: branches/5.2.x/install.php
===================================================================
diff -u -r12920 -r16518
--- branches/5.2.x/install.php	(.../5.0.x/install.php)	(revision 12920)
+++ branches/5.2.x/install.php	(.../5.2.x/install.php)	(revision 16518)
@@ -1,6 +1,6 @@
 <?php
 /**
-* @version	$Id: install.php 12920 2009-11-12 19:16:27Z alex $
+* @version	$Id: install.php 16518 2017-01-20 14:12:55Z alex $
 * @package	In-News
 * @copyright	Copyright (C) 1997 - 2009 Intechnic. All rights reserved.
 * @license      GNU/GPL
@@ -11,43 +11,48 @@
 * or other free or open source software licenses.
 * See http://www.in-portal.org/license for copyright notices and details.
 */
-	$module_folder = 'in-news';
+$module_folder = 'modules/in-news';
 
-	if (!defined('IS_INSTALL')) {
-		// separate module install
-		define('IS_INSTALL', 1);
-		define('ADMIN', 1);
-		define('REL_PATH', $module_folder);
-		define('FULL_PATH', realpath(dirname(__FILE__) . '/..') );
+if ( !defined('IS_INSTALL') ) {
+	// separate module install
+	define('IS_INSTALL', 1);
+	define('ADMIN', 1);
+	define('FULL_PATH', realpath(dirname(__FILE__) . '/../..'));
 
-		include_once(FULL_PATH . '/core/kernel/startup.php');
-		require_once FULL_PATH . '/core/install/install_toolkit.php';
+	include_once(FULL_PATH . '/core/kernel/startup.php');
+	require_once FULL_PATH . '/core/install/install_toolkit.php';
 
-		$toolkit = new kInstallToolkit();
+	$constants_file = FULL_PATH . '/' . $module_folder . '/constants.php';
+
+	if ( file_exists($constants_file) ) {
+		require_once $constants_file;
 	}
-	else {
-		// install, using installation wizard
-		$toolkit =& $this->toolkit;
-		/* @var $toolkit kInstallToolkit */
-	}
 
-	$application =& kApplication::Instance();
-	$application->Init();
+	$toolkit = new kInstallToolkit();
+}
+else {
+	// install, using installation wizard
+	/** @var kInstallToolkit $toolkit */
+	$toolkit =& $this->toolkit;
+}
 
-	if ($application->RecallVar('user_id') != -1) {
-		die('restricted access!');
-	}
+$application =& kApplication::Instance();
+$application->Init();
 
-	$category =& $toolkit->createModuleCategory('News', 'News Articles', '#in-news/section_design#', 'in-news/img/menu_articles.gif');
+if ( $application->RecallVar('user_id') != USER_ROOT ) {
+	die('restricted access!');
+}
 
-	$toolkit->RunSQL('/' . $module_folder . '/install/install_schema.sql');
-	$toolkit->RunSQL('/' . $module_folder . '/install/install_data.sql', '{NewsCatId}', $category->GetID());
-	$toolkit->ImportLanguage('/' . $module_folder . '/install/english');
+$category =& $toolkit->createModuleCategory('News', 'News Articles', '#in-news/section_design#', 'in-news/img/menu_articles.gif');
 
-	$toolkit->SetModuleRootCategory($module_folder, $category->GetID());
+$toolkit->RunSQL('/' . $module_folder . '/install/install_schema.sql');
+$toolkit->RunSQL('/' . $module_folder . '/install/install_data.sql', '{NewsCatId}', $category->GetID());
+$toolkit->ImportLanguage('/' . $module_folder . '/install/english', isset($constants_file));
 
-	$toolkit->linkCustomFields($module_folder, 'n', 2); // to create Custom Fields for News
-	$toolkit->linkCustomFields('KERNEL', 'c', 1); // to create ItemTemplate custom field
-	$toolkit->setModuleItemTemplate($category, 'n', '#in-news/item_design#');
+$toolkit->SetModuleRootCategory(basename($module_folder), $category->GetID());
 
-	$toolkit->finalizeModuleInstall($module_folder, true);
\ No newline at end of file
+$toolkit->linkCustomFields(basename($module_folder), 'n', 2); // to create Custom Fields for News
+$toolkit->linkCustomFields('KERNEL', 'c', 1); // to create ItemTemplate custom field
+$toolkit->setModuleItemTemplate($category, 'n', '#in-news/item_design#');
+
+$toolkit->finalizeModuleInstall($module_folder, true);