[10837] | 1 | <?php |
---|
[14527] | 2 | define('crypto_default_config', serialize(array( |
---|
[15996] | 3 | 'activate_on' => array( |
---|
| 4 | 'picture' => true, |
---|
[16311] | 5 | 'category' => true, |
---|
[15996] | 6 | 'register' => true, |
---|
| 7 | 'contactform' => true, |
---|
| 8 | 'guestbook' => true, |
---|
| 9 | ), |
---|
[12617] | 10 | 'comments_action' => 'reject', |
---|
| 11 | 'theme' => 'gray', |
---|
| 12 | 'captcha_type' => 'string', |
---|
| 13 | 'case_sensitive' => 'false', |
---|
| 14 | 'code_length' => 6, |
---|
[15996] | 15 | 'width' => 180, |
---|
| 16 | 'height' => 70, |
---|
[12617] | 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', |
---|
[19428] | 25 | 'button_color' => 'dark', |
---|
[12617] | 26 | ))); |
---|
| 27 | |
---|
[10837] | 28 | function plugin_install() |
---|
| 29 | { |
---|
| 30 | global $conf; |
---|
| 31 | |
---|
[15996] | 32 | conf_update_param('cryptographp', crypto_default_config); |
---|
[10837] | 33 | } |
---|
| 34 | |
---|
[11316] | 35 | function plugin_activate() |
---|
| 36 | { |
---|
| 37 | global $conf; |
---|
| 38 | |
---|
[12617] | 39 | if (isset($conf['cryptograph_theme'])) |
---|
[11316] | 40 | { |
---|
[14527] | 41 | pwg_query('DELETE FROM '.CONFIG_TABLE.' WHERE param="cryptographp_theme" LIMIT 1;'); |
---|
[11316] | 42 | } |
---|
[12617] | 43 | |
---|
[14527] | 44 | if (!isset($conf['cryptographp'])) |
---|
[12617] | 45 | { |
---|
[15996] | 46 | conf_update_param('cryptographp', crypto_default_config); |
---|
[12617] | 47 | } |
---|
[15996] | 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 | } |
---|
[19428] | 62 | if (!isset($conf['cryptographp']['button_color'])) |
---|
| 63 | { |
---|
| 64 | $conf['cryptographp']['button_color'] = 'dark'; |
---|
| 65 | conf_update_param('cryptographp', serialize($conf['cryptographp'])); |
---|
| 66 | } |
---|
[15996] | 67 | } |
---|
[11316] | 68 | } |
---|
[14527] | 69 | |
---|
[10837] | 70 | function plugin_uninstall() |
---|
| 71 | { |
---|
[12617] | 72 | pwg_query('DELETE FROM '.CONFIG_TABLE.' WHERE param="cryptographp" LIMIT 1'); |
---|
[10837] | 73 | } |
---|
| 74 | |
---|
| 75 | ?> |
---|