Changeset 26041 for extensions/CryptograPHP/maintain.inc.php
- Timestamp:
- Dec 19, 2013, 3:24:59 PM (10 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
extensions/CryptograPHP/maintain.inc.php
r20189 r26041 2 2 defined('PHPWG_ROOT_PATH') or die('Hacking attempt!'); 3 3 4 defined('CRYPTO_ID') or define('CRYPTO_ID', basename(dirname(__FILE__))); 5 include_once(PHPWG_PLUGINS_PATH . CRYPTO_ID . '/include/install.inc.php'); 4 class CryptograPHP_maintain extends PluginMaintain 5 { 6 private $installed = false; 6 7 7 function plugin_install() 8 { 9 crypto_install(); 10 define('crypto_installed', true); 11 } 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 } 12 68 13 function plugin_activate() 14 { 15 if (!defined('crypto_installed')) 69 $this->installed = true; 70 } 71 72 function activate($plugin_version, &$errors=array()) 16 73 { 17 crypto_install(); 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'); 18 87 } 19 88 } 20 21 function plugin_uninstall()22 {23 pwg_query('DELETE FROM '.CONFIG_TABLE.' WHERE param="cryptographp" LIMIT 1');24 }25 26 ?>
Note: See TracChangeset
for help on using the changeset viewer.