1 | <?php |
---|
2 | define('crypto_default_config', serialize(array( |
---|
3 | 'activate_on' => array( |
---|
4 | 'picture' => true, |
---|
5 | 'category' => true, |
---|
6 | 'register' => true, |
---|
7 | 'contactform' => true, |
---|
8 | 'guestbook' => true, |
---|
9 | ), |
---|
10 | 'comments_action' => 'reject', |
---|
11 | 'theme' => 'gray', |
---|
12 | 'captcha_type' => 'string', |
---|
13 | 'case_sensitive' => 'false', |
---|
14 | 'code_length' => 6, |
---|
15 | 'width' => 180, |
---|
16 | 'height' => 70, |
---|
17 | 'perturbation' => 1, |
---|
18 | 'image_bg_color' => 'ffffff', |
---|
19 | 'text_color' => '8a8a8a', |
---|
20 | 'num_lines' => 2, |
---|
21 | 'line_color' => '8a8a8a', |
---|
22 | 'noise_level' => 0.1, |
---|
23 | 'noise_color' => '8a8a8a', |
---|
24 | 'ttf_file' => 'TopSecret', |
---|
25 | 'button_color' => 'dark', |
---|
26 | ))); |
---|
27 | |
---|
28 | function plugin_install() |
---|
29 | { |
---|
30 | global $conf; |
---|
31 | |
---|
32 | conf_update_param('cryptographp', crypto_default_config); |
---|
33 | } |
---|
34 | |
---|
35 | function plugin_activate() |
---|
36 | { |
---|
37 | global $conf; |
---|
38 | |
---|
39 | if (isset($conf['cryptograph_theme'])) |
---|
40 | { |
---|
41 | pwg_query('DELETE FROM '.CONFIG_TABLE.' WHERE param="cryptographp_theme" LIMIT 1;'); |
---|
42 | } |
---|
43 | |
---|
44 | if (!isset($conf['cryptographp'])) |
---|
45 | { |
---|
46 | conf_update_param('cryptographp', crypto_default_config); |
---|
47 | } |
---|
48 | else |
---|
49 | { |
---|
50 | $conf['cryptographp'] = unserialize($conf['cryptographp']); |
---|
51 | if (!isset($conf['cryptographp']['activate_on'])) |
---|
52 | { |
---|
53 | $conf['cryptographp']['activate_on'] = array( |
---|
54 | 'picture' => $conf['cryptographp']['comments_action'] != 'inactive', |
---|
55 | 'category' => $conf['cryptographp']['comments_action'] != 'inactive', |
---|
56 | 'register' => true, |
---|
57 | 'contactform' => true, |
---|
58 | 'guestbook' => true, |
---|
59 | ); |
---|
60 | conf_update_param('cryptographp', serialize($conf['cryptographp'])); |
---|
61 | } |
---|
62 | if (!isset($conf['cryptographp']['button_color'])) |
---|
63 | { |
---|
64 | $conf['cryptographp']['button_color'] = 'dark'; |
---|
65 | conf_update_param('cryptographp', serialize($conf['cryptographp'])); |
---|
66 | } |
---|
67 | } |
---|
68 | } |
---|
69 | |
---|
70 | function plugin_uninstall() |
---|
71 | { |
---|
72 | pwg_query('DELETE FROM '.CONFIG_TABLE.' WHERE param="cryptographp" LIMIT 1'); |
---|
73 | } |
---|
74 | |
---|
75 | ?> |
---|