-
Notifications
You must be signed in to change notification settings - Fork 21
/
compat.php
285 lines (262 loc) · 6.6 KB
/
compat.php
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
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
<?php
/**
* Backward compatible functionality.
*
* PHP version 5
*
* @category CMSimple_XH
* @package XH
* @author Peter Harteg <peter@harteg.dk>
* @author The CMSimple_XH developers <devs@cmsimple-xh.org>
* @copyright 1999-2009 Peter Harteg
* @copyright 2009-2017 The CMSimple_XH developers <http://cmsimple-xh.org/?The_Team>
* @license http://www.gnu.org/licenses/gpl-3.0.en.html GNU GPLv3
* @link http://cmsimple-xh.org/
*/
/**
* Returns the code to display a photogallery.
*
* @param string $u Autogallery's installation folder.
*
* @global string The URL of the active page.
*
* @return string HTML
*
* @deprecated since 1.5.4. Use a gallery plugin instead.
*/
function autogallery($u)
{
global $su;
trigger_error('Function autogallery() is deprecated', E_USER_DEPRECATED);
return preg_replace(
"/.*<!-- autogallery -->(.*)<!-- \/autogallery -->.*/is",
'$1',
preg_replace(
"/(option value=\"\?)(p=)/is",
'${1}' . $su . '&$2',
preg_replace(
"/(href=\"\?)/is",
'${1}' . $su . '&',
preg_replace("/(src=\")(\.)/is", '${1}' . $u . '$2', geturlwp($u))
)
)
);
}
/**
* Returns the canonicalized absolute pathname on success.
* Otherwise returns its input.
*
* @param string $p The file name.
*
* @return string
*
* @deprecated since 1.5.4. Use realpath() instead.
*/
function rp($p)
{
trigger_error('Function rp() is deprecated', E_USER_DEPRECATED);
if (realpath($p) == '') {
return $p;
} else {
return realpath($p);
}
}
/**
* Returns '&' or '&' according to the setting of $cf['xhtml']['amp'].
*
* @return string HTML
*
* @global array The configuration of the core.
*
* @deprecated since 1.5.4. Use '&' instead.
*/
function amp()
{
global $cf;
trigger_error('Function amp() is deprecated', E_USER_DEPRECATED);
if ($cf['xhtml']['amp'] == 'true') {
return '&';
} else {
return '&';
}
}
/**
* Returns the link to the guestbook.
*
* @return string HTML
*
* @deprecated since 1.5.4
*/
function guestbooklink()
{
trigger_error('Function ' . __FUNCTION__ . '() is deprecated', E_USER_DEPRECATED);
if (function_exists('gblink')) {
return gblink();
}
}
/**
* Returns the link to the copyright and license informations.
*
* @return string HTML
*
* @global array The configuration of the core.
* @global string The script name.
*
* @deprecated since 1.5.8
*/
function legallink()
{
global $cf, $sn;
trigger_error('Function ' . __FUNCTION__ . '() is deprecated', E_USER_DEPRECATED);
return '<a href="' . $sn . '?' . uenc($cf['menu']['legal']) . '">'
. $cf['menu']['legal'] . '</a>';
}
/**
* Returns whether the file exists in the download folder
* and is available for download.
*
* @param string $fl The download URL, e.g. ?download=file.ext
*
* @return bool
*
* @global array The paths of system files and folders.
* @global string The script name.
*
* @deprecated since 1.6.
*/
function chkdl($fl)
{
global $pth, $sn;
trigger_error('Function ' . __FUNCTION__ . '() is deprecated', E_USER_DEPRECATED);
$m = false;
if (is_dir($pth['folder']['downloads'])) {
if ($fd = opendir($pth['folder']['downloads'])) {
while (($p = readdir($fd)) == true) {
if (preg_match("/.+\..+$/", $p)) {
if ($fl == $sn . '?download=' . $p) {
$m = true;
}
}
}
closedir($fd);
}
}
return $m;
}
/**
* Returns the content of file $filename, if it does exist, null otherwise.
*
* @param string $fl The file name.
*
* @return string
*
* @deprecated since 1.6
*/
function rf($fl)
{
trigger_error('Function ' . __FUNCTION__ . '() is deprecated', E_USER_DEPRECATED);
if (!file_exists($fl)) {
return;
}
clearstatcache();
return file_get_contents($fl);
}
/**
* Checks wether the file exists, is readable,
* and if $writeable is true, is writeable.
*
* Appends an according message to $e otherwise.
*
* @param string $fl A key of $pth['file'].
* @param bool $writable Whether the file has to writable.
*
* @global array The paths of system files and folders.
*
* @return bool
*
* @deprecated since 1.6.
*/
function chkfile($fl, $writable)
{
global $pth;
trigger_error('Function '. __FUNCTION__ . '() is deprecated', E_USER_DEPRECATED);
$t = isset($pth['file'][$fl]) ? $pth['file'][$fl] : '';
if ($t == '') {
e('undefined', 'file', $fl);
} elseif (!file_exists($t)) {
e('missing', $fl, $t);
} elseif (!is_readable($t)) {
e('notreadable', $fl, $t);
} elseif (!is_writable($t) && $writable) {
e('notwritable', $fl, $t);
}
}
/**
* Function preCallPlugins() => Pre-Call of Plugins.
*
* All Plugins which are called through a function-call
* can use this. At the moment it is'nt possible to do
* this with class-based plugins. They need to be called
* through standard-CMSimple-Scripting.
*
* Call a plugin: place this in your code (example):
* {{{PLUGIN:pluginfunction('parameters');}}}
*
* Call a built-in function (at the moment only one for
* demonstration):
* {{{HOME}}} or: {{{HOME:name_of_Link}}}
* This creates a link to the first page of your CMSimple-
* Installation.
*
* @param int $pageIndex The page index.
*
* @global bool Whether edit-mode is active.
* @global array The contents of all pages.
* @global int The Index of the active page.
* @global array The URLs of all pages.
*
* @return void
*
* @author mvwd
*
* @since 1.0
*
* @deprecated since 1.6
*/
function preCallPlugins($pageIndex = -1)
{
global $edit, $c, $s, $u;
trigger_error('Function preCallPlugins() is deprecated', E_USER_DEPRECATED);
if (!$edit) {
if ((int) $pageIndex > - 1 && (int) $pageIndex < count($u)) {
$as = $pageIndex;
} else {
$as = $s < 0 ? 0 : $s;
}
$c[$as] = evaluate_plugincall($c[$as]);
}
}
/**
* Appends a message to the logfile.
*
* On failure an according message is appended to $e.
*
* @param string $m The log message.
*
* @return void
*
* @global array The paths of system files and folders.
*
* @deprecated since 1.6
*/
function writelog($m)
{
global $pth;
trigger_error('Function ' . __FUNCTION__ . '() is deprecated', E_USER_DEPRECATED);
if ($fh = fopen($pth['file']['log'], "a")) {
fwrite($fh, $m);
fclose($fh);
} else {
e('cntwriteto', 'log', $pth['file']['log']);
}
}