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