-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathinstall.php
More file actions
33 lines (27 loc) · 781 Bytes
/
install.php
File metadata and controls
33 lines (27 loc) · 781 Bytes
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
<?php
/** $var array $config */
include 'main.php';
//check previewimages dir
$fp = __DIR__ . '\\' .$config['lime']['temppath.previewimages'];
$previewPath = normalizePath(__DIR__ . '\\' .$config['lime']['temppath.previewimages']);
if ($previewPath && !is_dir($previewPath)) {
mkdir($previewPath, 755, true);
}
/**
* Normalizes the given path
* @param string $path
* @return string
*/
function normalizePath ($path) {
$path = str_replace(['\\', '//'], '/', $path);
$parts = array_filter(explode('/', $path), 'strlen');
$tokens = [];
foreach ($parts as $part) {
if ('..' === $part) {
array_pop($tokens);
} elseif ('.' !== $part) {
array_push($tokens, $part);
}
}
return implode('/', $tokens);
}