1 | <?php |
---|
2 | |
---|
3 | load_language('plugin.lang', HIPE_PATH); |
---|
4 | |
---|
5 | function HIPE_infos($dir) |
---|
6 | { |
---|
7 | $path = $dir; |
---|
8 | |
---|
9 | $plg_data = implode( '', file($path.'main.inc.php') ); |
---|
10 | if ( preg_match("|Plugin Name: (.*)|", $plg_data, $val) ) |
---|
11 | { |
---|
12 | $plugin['name'] = trim( $val[1] ); |
---|
13 | } |
---|
14 | if (preg_match("|Version: (.*)|", $plg_data, $val)) |
---|
15 | { |
---|
16 | $plugin['version'] = trim($val[1]); |
---|
17 | } |
---|
18 | if ( preg_match("|Plugin URI: (.*)|", $plg_data, $val) ) |
---|
19 | { |
---|
20 | $plugin['uri'] = trim($val[1]); |
---|
21 | } |
---|
22 | if ($desc = load_language('description.txt', $path.'/', array('return' => true))) |
---|
23 | { |
---|
24 | $plugin['description'] = trim($desc); |
---|
25 | } |
---|
26 | elseif ( preg_match("|Description: (.*)|", $plg_data, $val) ) |
---|
27 | { |
---|
28 | $plugin['description'] = trim($val[1]); |
---|
29 | } |
---|
30 | if ( preg_match("|Author: (.*)|", $plg_data, $val) ) |
---|
31 | { |
---|
32 | $plugin['author'] = trim($val[1]); |
---|
33 | } |
---|
34 | if ( preg_match("|Author URI: (.*)|", $plg_data, $val) ) |
---|
35 | { |
---|
36 | $plugin['author uri'] = trim($val[1]); |
---|
37 | } |
---|
38 | if (!empty($plugin['uri']) and strpos($plugin['uri'] , 'extension_view.php?eid=')) |
---|
39 | { |
---|
40 | list( , $extension) = explode('extension_view.php?eid=', $plugin['uri']); |
---|
41 | if (is_numeric($extension)) $plugin['extension'] = $extension; |
---|
42 | } |
---|
43 | // IMPORTANT SECURITY ! |
---|
44 | $plugin = array_map('htmlspecialchars', $plugin); |
---|
45 | |
---|
46 | return $plugin ; |
---|
47 | } |
---|
48 | |
---|
49 | // Debugger function |
---|
50 | function HIPELog($var1, $var2, $var3, $var4) |
---|
51 | { |
---|
52 | $fo=fopen (HIPE_PATH.'log.txt','a') ; |
---|
53 | fwrite($fo,"======================\n") ; |
---|
54 | fwrite($fo,'le ' . date('D, d M Y H:i:s') . "\r\n"); |
---|
55 | fwrite($fo,$var1 ."\r\n") ; |
---|
56 | fwrite($fo,$var2 ."\r\n") ; |
---|
57 | fwrite($fo,$var3 ."\r\n") ; |
---|
58 | fwrite($fo,$var4 ."\r\n") ; |
---|
59 | fclose($fo) ; |
---|
60 | } |
---|
61 | ?> |
---|