[10837] | 1 | <?php |
---|
[20189] | 2 | defined('PHPWG_ROOT_PATH') or die('Hacking attempt!'); |
---|
[12617] | 3 | |
---|
[26041] | 4 | class CryptograPHP_maintain extends PluginMaintain |
---|
[10837] | 5 | { |
---|
[26041] | 6 | private $installed = false; |
---|
[10837] | 7 | |
---|
[26041] | 8 | function install($plugin_version, &$errors=array()) |
---|
[11316] | 9 | { |
---|
[26072] | 10 | global $conf; |
---|
| 11 | |
---|
[26041] | 12 | if (isset($conf['cryptograph_theme'])) |
---|
| 13 | { |
---|
| 14 | conf_delete_param('cryptograph_theme'); |
---|
| 15 | } |
---|
| 16 | |
---|
| 17 | if (empty($conf['cryptographp'])) |
---|
| 18 | { |
---|
| 19 | $default_config = array( |
---|
| 20 | 'activate_on' => array( |
---|
| 21 | 'picture' => true, |
---|
| 22 | 'category' => true, |
---|
| 23 | 'register' => true, |
---|
| 24 | 'contactform' => true, |
---|
| 25 | 'guestbook' => true, |
---|
| 26 | ), |
---|
| 27 | 'comments_action' => 'reject', |
---|
| 28 | 'theme' => 'gray', |
---|
| 29 | 'captcha_type' => 'string', |
---|
| 30 | 'case_sensitive' => 'false', |
---|
| 31 | 'code_length' => 6, |
---|
| 32 | 'width' => 180, |
---|
| 33 | 'height' => 70, |
---|
| 34 | 'perturbation' => 1, |
---|
| 35 | 'image_bg_color' => 'ffffff', |
---|
| 36 | 'text_color' => '8a8a8a', |
---|
| 37 | 'num_lines' => 2, |
---|
| 38 | 'line_color' => '8a8a8a', |
---|
| 39 | 'noise_level' => 0.1, |
---|
| 40 | 'noise_color' => '8a8a8a', |
---|
| 41 | 'ttf_file' => 'TopSecret', |
---|
| 42 | 'button_color' => 'dark', |
---|
| 43 | ); |
---|
| 44 | |
---|
| 45 | $conf['cryptographp'] = serialize($default_config); |
---|
| 46 | conf_update_param('cryptographp', $conf['cryptographp']); |
---|
| 47 | } |
---|
| 48 | else |
---|
| 49 | { |
---|
| 50 | $old_conf = is_string($conf['cryptographp']) ? unserialize($conf['cryptographp']) : $conf['cryptographp']; |
---|
| 51 | |
---|
| 52 | if (!isset($old_conf['activate_on'])) |
---|
| 53 | { |
---|
| 54 | $old_conf['activate_on'] = array( |
---|
| 55 | 'picture' => $old_conf['comments_action'] != 'inactive', |
---|
| 56 | 'category' => $old_conf['comments_action'] != 'inactive', |
---|
| 57 | 'register' => true, |
---|
| 58 | 'contactform' => true, |
---|
| 59 | 'guestbook' => true, |
---|
| 60 | ); |
---|
| 61 | } |
---|
| 62 | if (!isset($old_conf['button_color'])) |
---|
| 63 | { |
---|
| 64 | $old_conf['button_color'] = 'dark'; |
---|
| 65 | } |
---|
| 66 | |
---|
| 67 | $conf['cryptographp'] = serialize($old_conf); |
---|
| 68 | conf_update_param('cryptographp', $conf['cryptographp']); |
---|
| 69 | } |
---|
| 70 | |
---|
| 71 | $this->installed = true; |
---|
[11316] | 72 | } |
---|
[14527] | 73 | |
---|
[26041] | 74 | function activate($plugin_version, &$errors=array()) |
---|
| 75 | { |
---|
| 76 | if (!$this->installed) |
---|
| 77 | { |
---|
| 78 | $this->install($plugin_version, $errors); |
---|
| 79 | } |
---|
| 80 | } |
---|
[10837] | 81 | |
---|
[26041] | 82 | function deactivate() |
---|
| 83 | { |
---|
| 84 | } |
---|
| 85 | |
---|
| 86 | function uninstall() |
---|
| 87 | { |
---|
| 88 | conf_delete_param('cryptographp'); |
---|
| 89 | } |
---|
| 90 | } |
---|