Line | |
---|
1 | <?php |
---|
2 | defined('PHPWG_ROOT_PATH') or die('Hacking attempt!'); |
---|
3 | |
---|
4 | class EasyCaptcha_maintain extends PluginMaintain |
---|
5 | { |
---|
6 | function install($plugin_version, &$errors=array()) |
---|
7 | { |
---|
8 | global $conf; |
---|
9 | |
---|
10 | if (empty($conf['EasyCaptcha'])) |
---|
11 | { |
---|
12 | $default_config = array( |
---|
13 | 'activate_on' => array( |
---|
14 | 'picture' => true, |
---|
15 | 'category' => true, |
---|
16 | 'register' => true, |
---|
17 | 'contactform' => true, |
---|
18 | 'guestbook' => true, |
---|
19 | ), |
---|
20 | 'comments_action' => 'reject', |
---|
21 | 'guest_only' => true, |
---|
22 | 'challenge' => 'random', |
---|
23 | 'drag' => array( |
---|
24 | 'theme' => 'icons', |
---|
25 | 'size' => 50, |
---|
26 | 'nb' => 5, |
---|
27 | 'bg1' => '#F7F7F7', |
---|
28 | 'bg2' => '#E5E5E5', |
---|
29 | 'obj' => '#FFFFFF', |
---|
30 | 'sel' => '#C8FF96', |
---|
31 | 'bd1' => '#DDDDDD', |
---|
32 | 'bd2' => '#555555', |
---|
33 | 'txt' => '#222222', |
---|
34 | ), |
---|
35 | 'tictac' => array( |
---|
36 | 'size' => 128, |
---|
37 | 'bg1' => '#F7F7F7', |
---|
38 | 'bg2' => '#E5E5E5', |
---|
39 | 'bd' => '#DDDDDD', |
---|
40 | 'obj' => '#00B4F7', |
---|
41 | 'sel' => '#F7B400', |
---|
42 | ), |
---|
43 | 'lastmod' => time(), |
---|
44 | ); |
---|
45 | |
---|
46 | conf_update_param('EasyCaptcha', $default_config, true); |
---|
47 | } |
---|
48 | else |
---|
49 | { |
---|
50 | $old_conf = safe_unserialize($conf['EasyCaptcha']); |
---|
51 | |
---|
52 | if (empty($old_conf['lastmod'])) |
---|
53 | { |
---|
54 | $old_conf['lastmod'] = time(); |
---|
55 | } |
---|
56 | if (!isset($old_conf['guest_only'])) |
---|
57 | { |
---|
58 | $old_conf['guest_only'] = true; |
---|
59 | } |
---|
60 | |
---|
61 | conf_update_param('EasyCaptcha', $old_conf, true); |
---|
62 | } |
---|
63 | } |
---|
64 | |
---|
65 | function update($old_version, $new_version, &$errors=array()) |
---|
66 | { |
---|
67 | $this->install($new_version, $errors); |
---|
68 | } |
---|
69 | |
---|
70 | function uninstall() |
---|
71 | { |
---|
72 | conf_delete_param('EasyCaptcha'); |
---|
73 | } |
---|
74 | } |
---|
Note: See
TracBrowser
for help on using the repository browser.