source: extensions/CryptograPHP/maintain.inc.php @ 26041

Last change on this file since 26041 was 26041, checked in by mistic100, 10 years ago

update for 2.6

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