1 | <?php |
---|
2 | function media_icon_install_general($config) { |
---|
3 | $query = 'INSERT INTO '.CONFIG_TABLE.' (param,value,comment) VALUES ("media_icon_general" ,"'.pwg_db_real_escape_string(serialize($config)).'", "Media Icon plugin general parameters");'; |
---|
4 | pwg_query($query); |
---|
5 | } |
---|
6 | |
---|
7 | function media_icon_install_advanced($config) { |
---|
8 | $query = 'INSERT INTO '.CONFIG_TABLE.' (param,value,comment) VALUES ("media_icon_advanced" ,"'.pwg_db_real_escape_string(serialize($config)).'", "Media Icon plugin advanced parameters");'; |
---|
9 | pwg_query($query); |
---|
10 | } |
---|
11 | |
---|
12 | function media_icon_update_db() { |
---|
13 | global $conf; |
---|
14 | include(dirname(__FILE__).'/config_default.inc.php'); |
---|
15 | |
---|
16 | $config_general = array(); |
---|
17 | $config_advanced = array(); |
---|
18 | $conf_media_icon_general = unserialize($conf['media_icon_general']); |
---|
19 | $conf_media_icon_advanced = unserialize($conf['media_icon_advanced']); |
---|
20 | |
---|
21 | if (isset($conf['media_icon'])) { |
---|
22 | $query = 'DELETE FROM ' . CONFIG_TABLE . ' WHERE (param="media_icon");'; |
---|
23 | pwg_query($query); |
---|
24 | } |
---|
25 | |
---|
26 | if (isset($conf_media_icon_general)) { |
---|
27 | foreach ($config_default_general as $key => $value) { |
---|
28 | if (is_array($config_default_general[$key])) { |
---|
29 | foreach ($config_default_general[$key] as $key2 => $value2) { |
---|
30 | if (is_array($config_default_general[$key][$key2])) { |
---|
31 | foreach ($config_default_general[$key][$key2] as $key3 => $value3) { |
---|
32 | if (isset($conf_media_icon_general[$key][$key2][$key3])) |
---|
33 | $config_general[$key][$key2][$key3] = $conf_media_icon_general[$key][$key2][$key3]; |
---|
34 | else |
---|
35 | $config_general[$key][$key2][$key3] = $config_default_general[$key][$key2][$key3]; |
---|
36 | } |
---|
37 | } else { |
---|
38 | if (isset($conf_media_icon_general[$key][$key2])) |
---|
39 | $config_general[$key][$key2] = $conf_media_icon_general[$key][$key2]; |
---|
40 | else |
---|
41 | $config_general[$key][$key2] = $config_default_general[$key][$key2]; |
---|
42 | } |
---|
43 | } |
---|
44 | } else { |
---|
45 | if (isset($conf_media_icon_general[$key][$key2])) |
---|
46 | $config_general[$key] = $conf_media_icon_general[$key]; |
---|
47 | else |
---|
48 | $config_general[$key] = $config_default_general[$key]; |
---|
49 | } |
---|
50 | } |
---|
51 | media_icon_delete_conf("media_icon_general"); |
---|
52 | media_icon_install_general($config_general); |
---|
53 | } else { |
---|
54 | media_icon_install_general($config_default_general); |
---|
55 | } |
---|
56 | |
---|
57 | if (isset($conf_media_icon_advanced)) { |
---|
58 | foreach ($config_default_advanced as $key => $value) { |
---|
59 | if (isset($conf_media_icon_advanced[$key][$key2])) |
---|
60 | $config_advanced[$key] = $conf_media_icon_advanced[$key]; |
---|
61 | else |
---|
62 | $config_advanced[$key] = $config_default_advanced[$key]; |
---|
63 | } |
---|
64 | media_icon_delete_conf("media_icon_advanced"); |
---|
65 | media_icon_install_advanced($config_advanced); |
---|
66 | } else { |
---|
67 | media_icon_install_advanced($config_default_advanced); |
---|
68 | } |
---|
69 | } |
---|
70 | |
---|
71 | function media_icon_delete_conf($where) { |
---|
72 | $query = 'DELETE FROM ' . CONFIG_TABLE . ' WHERE (param="'.$where.'");'; |
---|
73 | pwg_query($query); |
---|
74 | } |
---|
75 | ?> |
---|