1 | <?php |
---|
2 | define('crypto_default_config', serialize(array( |
---|
3 | 'activate_on' => array( |
---|
4 | 'picture' => true, |
---|
5 | 'catgeory' => 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 | ))); |
---|
26 | |
---|
27 | function plugin_install() |
---|
28 | { |
---|
29 | global $conf; |
---|
30 | |
---|
31 | conf_update_param('cryptographp', crypto_default_config); |
---|
32 | } |
---|
33 | |
---|
34 | function plugin_activate() |
---|
35 | { |
---|
36 | global $conf; |
---|
37 | |
---|
38 | if (isset($conf['cryptograph_theme'])) |
---|
39 | { |
---|
40 | pwg_query('DELETE FROM '.CONFIG_TABLE.' WHERE param="cryptographp_theme" LIMIT 1;'); |
---|
41 | } |
---|
42 | |
---|
43 | if (!isset($conf['cryptographp'])) |
---|
44 | { |
---|
45 | conf_update_param('cryptographp', crypto_default_config); |
---|
46 | } |
---|
47 | else |
---|
48 | { |
---|
49 | $conf['cryptographp'] = unserialize($conf['cryptographp']); |
---|
50 | if (!isset($conf['cryptographp']['activate_on'])) |
---|
51 | { |
---|
52 | $conf['cryptographp']['activate_on'] = array( |
---|
53 | 'picture' => $conf['cryptographp']['comments_action'] != 'inactive', |
---|
54 | 'category' => $conf['cryptographp']['comments_action'] != 'inactive', |
---|
55 | 'register' => true, |
---|
56 | 'contactform' => true, |
---|
57 | 'guestbook' => true, |
---|
58 | ); |
---|
59 | conf_update_param('cryptographp', serialize($conf['cryptographp'])); |
---|
60 | } |
---|
61 | } |
---|
62 | } |
---|
63 | |
---|
64 | function plugin_uninstall() |
---|
65 | { |
---|
66 | pwg_query('DELETE FROM '.CONFIG_TABLE.' WHERE param="cryptographp" LIMIT 1'); |
---|
67 | } |
---|
68 | |
---|
69 | ?> |
---|