Changeset 26025 for extensions/EasyCaptcha/maintain.inc.php
- Timestamp:
- Dec 18, 2013, 6:48:06 PM (10 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
extensions/EasyCaptcha/maintain.inc.php
r24215 r26025 2 2 defined('PHPWG_ROOT_PATH') or die('Hacking attempt!'); 3 3 4 defined('EASYCAPTCHA_ID') or define('EASYCAPTCHA_ID', basename(dirname(__FILE__))); 5 include_once(PHPWG_PLUGINS_PATH . EASYCAPTCHA_ID . '/include/install.inc.php'); 4 class EasyCaptcha_maintain extends PluginMaintain 5 { 6 private $installed = false; 6 7 7 function plugin_install() 8 { 9 easycaptcha_install(); 10 define('easycaptcha_installed', true); 11 } 8 function install($plugin_version, &$errors=array()) 9 { 10 global $conf; 12 11 13 function plugin_activate() 14 { 15 if (!defined('easycaptcha_installed')) 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; 64 } 65 66 function activate($plugin_version, &$errors=array()) 16 67 { 17 easycaptcha_install(); 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'); 18 81 } 19 82 } 20 21 function plugin_uninstall()22 {23 pwg_query('DELETE FROM '.CONFIG_TABLE.' WHERE param="EasyCaptcha" LIMIT 1');24 }
Note: See TracChangeset
for help on using the changeset viewer.