-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathprecheck.php
More file actions
152 lines (138 loc) · 5.34 KB
/
Copy pathprecheck.php
File metadata and controls
152 lines (138 loc) · 5.34 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
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
<?php
/**
* kitForm
*
* @author Ralf Hertsch <ralf.hertsch@phpmanufaktur.de>
* @link http://phpmanufaktur.de
* @copyright 2011 - 2012
* @license MIT License (MIT) http://www.opensource.org/licenses/MIT
*/
// include class.secure.php to protect this file and the whole CMS!
if (defined('WB_PATH')) {
if (defined('LEPTON_VERSION'))
include(WB_PATH.'/framework/class.secure.php');
}
else {
$oneback = "../";
$root = $oneback;
$level = 1;
while (($level < 10) && (!file_exists($root.'/framework/class.secure.php'))) {
$root .= $oneback;
$level += 1;
}
if (file_exists($root.'/framework/class.secure.php')) {
include($root.'/framework/class.secure.php');
}
else {
trigger_error(sprintf("[ <b>%s</b> ] Can't include class.secure.php!", $_SERVER['SCRIPT_NAME']), E_USER_ERROR);
}
}
// end include class.secure.php
// Checking Requirements
global $database;
$checked = true;
// check PHP version
$PRECHECK['PHP_VERSION'] = array(
'VERSION' => '5.2.0',
'OPERATOR' => '>='
);
// check dependencies for KIT at runtime but not at installation!
$PRECHECK['KIT'] = array(
'kit' => array('VERSION' => '0.61', 'OPERATOR' => '>='),
'kit_dirlist' => array('VERSION' => '0.28', 'OPERATOR' => '>=')
);
// modified precheck array
$check = array(
'dbConnect_LE' => array(
'directory' => 'dbconnect_le',
'version' => '0.68',
'problem' => 'dbConnect_LE => <b><a href="https://addons.phpmanufaktur.de/download.php?file=dbConnect_LE" target="_blank">Download actual version</a></b>'
),
'KeepInTouch' => array(
'directory' => 'kit',
'version' => '0.10',
'problem' => 'KeepInTouch => <b><a href="https://addons.phpmanufaktur.de/download.php?file=KeepInTouch" target="_blank">Download actual version</a></b>'
),
'kitTools' => array(
'directory' => 'kit_tools',
'version' => '0.16',
'problem' => 'kitTools => <b><a href="https://addons.phpmanufaktur.de/download.php?file=kitTools" target="_blank">Download actual version</a></b>'
),
'wbLib' => array(
'directory' => 'wblib',
'version' => '0.65',
'problem' => 'wbLib => <b><a href="https://github.com/webbird/wblib/downloads" target="_blank">Download actual version</a></b>'
),
'LibraryAdmin' => array(
'directory' => 'libraryadmin',
'version' => '1.9',
'problem' => 'LibraryAdmin => <b><a href="http://jquery.lepton-cms.org/modules/download_gallery/dlc.php?file=75&id=1318585713" target="_blank">Download actual version</a></b>'
),
'libJQuery' => array(
'directory' => 'lib_jquery',
'version' => '1.25',
'problem' => 'libJQuery => <b><a href="http://jquery.lepton-cms.org/modules/download_gallery/dlc.php?file=76&id=1320743410" target="_blank">Download actual version</a></b>'
),
);
if (!defined('CAT_VERSION')) {
$check['Dwoo'] = array(
'directory' => 'dwoo',
'version' => '0.16',
'problem' => 'Dwoo => <b><a href="https://addons.phpmanufaktur.de/download.php?file=Dwoo" target="_blank">Download actual version</a></b>'
);
$check['dropletsExtension'] = array(
'directory' => 'droplets_extension',
'version' => '0.24',
'problem' => 'dropletsExtension => <b><a href="https://addons.phpmanufaktur.de/download.php?file=dropletsExtension" target="_blank">Download actual version</a></b>'
);
}
$versionSQL = "SELECT `version` FROM `".TABLE_PREFIX."addons` WHERE `directory`='%s'";
foreach ($check as $name => $addon) {
// loop throug the addons and check the versions
$version = $database->get_one(sprintf($versionSQL, $addon['directory']), MYSQL_ASSOC);
if (false === ($status = version_compare(!empty($version) ? $version : '0', $addon['version'], '>='))) {
$checked = false;
$key = $addon['problem'];
}
else
$key = $name;
$PRECHECK['CUSTOM_CHECKS'][$key] = array(
'REQUIRED' => $addon['version'],
'ACTUAL' => !empty($version) ? $version : '- not installed -',
'STATUS' => $status
);
}
// check default charset
$SQL = "SELECT `value` FROM `".TABLE_PREFIX."settings` WHERE `name`='default_charset'";
$charset = $database->get_one($SQL, MYSQL_ASSOC);
if ($charset != 'utf-8') {
$checked = false;
$key = 'This addon needs UTF-8 as default charset!';
}
else
$key = 'UTF-8';
$PRECHECK['CUSTOM_CHECKS'][$key] = array(
'REQUIRED' => 'utf-8',
'ACTUAL' => $charset,
'STATUS' => ($charset == 'utf-8')
);
// jQueryAdmin should be uninstalled
if (file_exists(WB_PATH . '/modules/jqueryadmin/tool.php')) {
$checked = false;
$key = 'jQueryAdmin is <b>deprecated</b>, please uninstall and<br />use <b>LibraryAdmin</b> instead!';
}
else
$key = 'jQueryAdmin';
$PRECHECK['CUSTOM_CHECKS'][$key] = array(
'REQUIRED' => 'REMOVED',
'ACTUAL' => (file_exists(WB_PATH . '/modules/jqueryadmin/tool.php')) ? 'INSTALLED' : 'REMOVED',
'STATUS' => (!file_exists(WB_PATH . '/modules/jqueryadmin/tool.php'))
);
if (!$checked) {
// if a problem occured prompt a hint and grant that the LEPTON/WB precheck fail
$PRECHECK['CUSTOM_CHECKS']['Please install or update all required addons.<br />Need help? Please contact the <b><a href="https://phpmanufaktur.de/support" target="_blank">phpManufaktur Support Group</a></b>.'] = array(
'REQUIRED' => 'OK',
'ACTUAL' => 'PROBLEM',
'STATUS' => false
);
}