forked from evolution-cms/evolution
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathfunctions.php
More file actions
112 lines (100 loc) · 3.1 KB
/
Copy pathfunctions.php
File metadata and controls
112 lines (100 loc) · 3.1 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
<?php
function install_sessionCheck()
{
global $_lang;
// session loop-back tester
if(!isset($_GET['action']) || $_GET['action']!=='mode')
{
if(!isset($_SESSION['test']) || $_SESSION['test']!=1)
{
echo '
<html>
<head>
<title>Install Problem</title>
<style type="text/css">
*{margin:0;padding:0}
body{margin:150px;background:#eee;}
.install{padding:10px;border:3px solid #ffc565;background:#ffddb4;margin:0 auto;text-align:center;}
p{ margin:20px 0; }
a{margin-top:30px;padding:5px;}
</style>
</head>
<body>
<div class="install">
<p>' . $_lang["session_problem"] . '</p>
<p><a href="./">' .$_lang["session_problem_try_again"] . '</a></p>
</div>
</body>
</html>';
exit;
}
}
}
function parse($src,$ph,$left='[+',$right='+]')
{
foreach($ph as $k=>$v)
{
$k = $left . $k . $right;
$src = str_replace($k,$v,$src);
}
return $src;
}
function ph()
{
global $_lang,$moduleName,$moduleVersion,$modx_textdir,$modx_release_date;
if(isset($_SESSION['installmode'])) $installmode = $_SESSION['installmode'];
else $installmode = get_installmode();
$ph['pagetitle'] = $_lang['modx_install'];
$ph['textdir'] = $modx_textdir ? ' id="rtl"':'';
$ph['help_link'] = $installmode == 0 ? $_lang['help_link_new'] : $_lang['help_link_upd'];
$ph['version'] = $moduleVersion;
$ph['release_date'] = ($modx_textdir ? '‏':'') . $modx_release_date;
$ph['footer1'] = $_lang['modx_footer1'];
$ph['footer2'] = $_lang['modx_footer2'];
$ph['current_year'] = date('Y');
return $ph;
}
function get_installmode()
{
global $base_path,$database_server, $database_user, $database_password, $dbase, $table_prefix;
$conf_path = "{$base_path}manager/includes/config.inc.php";
if (!is_file($conf_path)) $installmode = 0;
elseif(isset($_POST['installmode'])) $installmode = $_POST['installmode'];
else
{
include_once("{$base_path}manager/includes/config.inc.php");
if(!isset($dbase) || empty($dbase)) $installmode = 0;
else
{
$conn = mysqli_connect($database_server, $database_user, $database_password);
if($conn)
{
$_SESSION['database_server'] = $database_server;
$_SESSION['database_user'] = $database_user;
$_SESSION['database_password'] = $database_password;
$dbase = trim($dbase, '`');
$rs = mysqli_select_db($conn, $dbase);
}
else $rs = false;
if($rs)
{
$_SESSION['dbase'] = $dbase;
$_SESSION['table_prefix'] = $table_prefix;
$_SESSION['database_collation'] = 'utf8_general_ci';
$_SESSION['database_connection_method'] = 'SET CHARACTER SET';
$tbl_system_settings = "`{$dbase}`.`{$table_prefix}system_settings`";
$rs = mysqli_query($conn, "SELECT setting_value FROM {$tbl_system_settings} WHERE setting_name='settings_version'");
if($rs)
{
$row = mysqli_fetch_assoc($rs);
$settings_version = $row['setting_value'];
}
else $settings_version = '';
if (empty($settings_version)) $installmode = 0;
else $installmode = 1;
}
else $installmode = 1;
}
}
return $installmode;
}