Line | |
---|
1 | <?php |
---|
2 | |
---|
3 | function plugin_install() |
---|
4 | { |
---|
5 | global $prefixeTable; |
---|
6 | $q = ' |
---|
7 | INSERT INTO ' . CONFIG_TABLE . ' (param,value,comment) |
---|
8 | VALUES |
---|
9 | ("imgpreview" , "400#600#true#true#false" , "max-width#max-height#title#opacity#preloadImages");'; |
---|
10 | pwg_query($q); |
---|
11 | |
---|
12 | } |
---|
13 | |
---|
14 | |
---|
15 | |
---|
16 | function plugin_activate() |
---|
17 | { |
---|
18 | global $prefixeTable, $conf; |
---|
19 | //////////// Check Config |
---|
20 | $query = ' |
---|
21 | SELECT COUNT(*) AS result FROM '.CONFIG_TABLE.' |
---|
22 | WHERE param IN (\'imgpreview\') |
---|
23 | ;'; |
---|
24 | $data_table = pwg_db_fetch_assoc(pwg_query($query)); |
---|
25 | $exist = $data_table['result']; |
---|
26 | if ( $exist == 0 ) |
---|
27 | { |
---|
28 | plugin_install(); |
---|
29 | } |
---|
30 | else { |
---|
31 | load_conf_from_db(); |
---|
32 | |
---|
33 | if (count(explode("#" , $conf['imgpreview']))!=5) |
---|
34 | { |
---|
35 | pwg_query('DELETE FROM '.CONFIG_TABLE.' WHERE param IN (\'imgpreview\')'); |
---|
36 | pwg_query($q); |
---|
37 | plugin_install(); |
---|
38 | } |
---|
39 | } |
---|
40 | }//fin active |
---|
41 | |
---|
42 | |
---|
43 | |
---|
44 | |
---|
45 | function plugin_uninstall() |
---|
46 | { |
---|
47 | global $prefixeTable; |
---|
48 | pwg_query('DELETE FROM '.CONFIG_TABLE.' WHERE param IN (\'imgpreview\')'); |
---|
49 | }//fin uninstall |
---|
50 | |
---|
51 | |
---|
52 | ?> |
---|
Note: See
TracBrowser
for help on using the repository browser.