-
Notifications
You must be signed in to change notification settings - Fork 5
/
common.php
33 lines (29 loc) · 902 Bytes
/
common.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
<?php
// Smarty
require_once("Smarty.class.php");
require_once("config.php");
function smarty_init() {
$config = config();
$smarty = new Smarty();
$smarty->template_dir = $config['application_dir'] . '/templates/';
$smarty->config_dir = $config['application_dir'] . '/configs/';
$smarty->compile_dir = $config['tmp_dir'] . '/smarty/templates_c/';
$smarty->cache_dir = $config['tmp_dir'] . '/smarty/cache/';
return $smarty;
}
function get_files_in_directory($dir, $extension) {
$result = array();
if ($handle = opendir($dir)) {
while (false !== ($file = readdir($handle))) {
if ($file != "." && $file != ".." && (substr($file, -strlen($extension)) == $extension)) {
$result[] = $file;
}
}
}
return $result;
}
function check_path($dir, $name) {
$path = realpath($dir . "/" . $file);
return (strpos($path, $dir) === 0);
}
?>