Issues (60)

settings.php (1 issue)

Severity
1
<?php
2
3
/**
4
 * @package SimplePortal ElkArte
5
 *
6
 * @author SimplePortal Team
7
 * @copyright 2015-2021 SimplePortal Team
8
 * @license BSD 3-clause
9
 * @version 1.0.0
10
 */
11
12
if (file_exists(dirname(__FILE__) . '/SSI.php') && !defined('ELK'))
13
{
14
	require_once(dirname(__FILE__) . '/SSI.php');
15
}
16
elseif (!defined('ELK'))
17
{
18
	exit('<b>Error:</b> Cannot install - please verify you put this in the same place as ELK\'s index.php.');
19
}
20
21
global $modSettings, $package_cache;
22
23
$defaults = array(
24
	'sp_portal_mode' => 1,
25
	'sp_disableForumRedirect' => 1,
26
	'showleft' => 1,
27
	'showright' => 1,
28
	'leftwidth' => '225px',
29
	'rightwidth' => '225px',
30
	'sp_adminIntegrationHide' => 1,
31
	'sp_resize_images' => 1,
32
	'sp_articles_index_per_page' => 5,
33
	'sp_articles_index_total' => 20,
34
	'sp_articles_per_page' => 10,
35
	'sp_articles_comments_per_page' => 20,
36
	'sp_articles_attachment_dir' => BOARDDIR . '/sp_attach',
37
);
38
39
$updates = array(
40
	'sp_version' => '1.0.0',
41
	'front_page' => 'PortalMain_Controller',
42
	'admin_features' => $modSettings['admin_features'] . ',pt'
43
);
44
45
foreach ($defaults as $index => $value)
46
{
47
	if (!isset($modSettings[$index]))
48
	{
49
		$updates[$index] = $value;
50
	}
51
}
52
53
updateSettings($updates);
54
55
// Enable the core feature by default on install
56
Hooks::instance()->enableIntegration('Portal_Integrate');
57
58
$standalone_file = BOARDDIR . '/PortalStandalone.php';
59
60
if (isset($package_cache[$standalone_file]))
61
{
62
	$package_cache[$standalone_file] = str_replace('full/path/to/forum', BOARDDIR, $package_cache[$standalone_file]);
63
}
64
elseif (file_exists($standalone_file))
65
{
66
	$current_data = file_get_contents($standalone_file);
67
	if (strpos($current_data, 'full/path/to/forum') !== false)
68
	{
69
		$fp = fopen($standalone_file, 'w+');
70
		fwrite($fp, str_replace('full/path/to/forum', BOARDDIR, $current_data));
71
		fclose($fp);
72
	}
73
}
74
75
if (ELK === 'SSI')
0 ignored issues
show
The condition ELK === 'SSI' is always true.
Loading history...
76
{
77
	echo 'Settings changes were carried out successfully.';
78
}
79