-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathmaintain.inc.php
52 lines (40 loc) · 961 Bytes
/
maintain.inc.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
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
<?php
function plugin_install()
{
global $prefixeTable;
$q = '
INSERT INTO ' . CONFIG_TABLE . ' (param,value,comment)
VALUES
("imgpreview" , "400#600#true#true#false" , "max-width#max-height#title#opacity#preloadImages");';
pwg_query($q);
}
function plugin_activate()
{
global $prefixeTable, $conf;
//////////// Check Config
$query = '
SELECT COUNT(*) AS result FROM '.CONFIG_TABLE.'
WHERE param IN (\'imgpreview\')
;';
$data_table = pwg_db_fetch_assoc(pwg_query($query));
$exist = $data_table['result'];
if ( $exist == 0 )
{
plugin_install();
}
else {
load_conf_from_db();
if (count(explode("#" , $conf['imgpreview']))!=5)
{
pwg_query('DELETE FROM '.CONFIG_TABLE.' WHERE param IN (\'imgpreview\')');
pwg_query($q);
plugin_install();
}
}
}//fin active
function plugin_uninstall()
{
global $prefixeTable;
pwg_query('DELETE FROM '.CONFIG_TABLE.' WHERE param IN (\'imgpreview\')');
}//fin uninstall
?>