Changeset 8054 for extensions/captcha/maintain.inc.php
- Timestamp:
- Dec 9, 2010, 12:49:42 PM (13 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
extensions/captcha/maintain.inc.php
r8034 r8054 2 2 function plugin_install() 3 3 { 4 $q = ' 5 INSERT INTO '.CONFIG_TABLE.' (param,value,comment) 6 VALUES 7 ("captcha_publickey","","Captcha public key") 8 ;'; 9 pwg_query($q); 10 $q = ' 11 INSERT INTO '.CONFIG_TABLE.' (param,value,comment) 12 VALUES 13 ("captcha_privatekey","","Captcha private key") 14 ;'; 15 pwg_query($q); 4 global $conf; 5 6 if (!isset($conf['captcha_publickey'])) 7 { 8 $q = 'INSERT INTO '.CONFIG_TABLE.' (param,value,comment) VALUES ("captcha_publickey","","Captcha public key");'; 9 pwg_query($q); 10 } 11 12 if (!isset($conf['captcha_privatekey'])) 13 { 14 $q = 'INSERT INTO '.CONFIG_TABLE.' (param,value,comment) VALUES ("captcha_privatekey","","Captcha private key");'; 15 pwg_query($q); 16 } 17 18 if (!isset($conf['captcha_theme'])) 19 { 20 $q = 'INSERT INTO '.CONFIG_TABLE.' (param,value,comment) VALUES ("captcha_theme","red","Captcha theme");'; 21 pwg_query($q); 22 } 16 23 } 17 24 18 function plugin_activate( )25 function plugin_activate($id, $version, &$errors) 19 26 { 20 27 global $conf; … … 22 29 if (!isset($conf['captcha_theme'])) 23 30 { 24 $q = ' 25 INSERT INTO '.CONFIG_TABLE.' (param,value,comment) 26 VALUES 27 ("captcha_theme","red","Captcha theme") 28 ;'; 29 pwg_query($q); 31 plugin_install(); 32 } 33 34 // Check if API is responding 35 include(PHPWG_PLUGINS_PATH.basename(dirname(__FILE__)).'/recaptchalib.php'); 36 $response = _recaptcha_http_post(RECAPTCHA_VERIFY_SERVER, "/recaptcha/api/verify", array ()); 37 $answers = explode ("\n", $response [1]); 38 39 if ($answers[0] != 'true' and $answers[0] != 'false') 40 { 41 array_push($errors, l10n('Piwigo can\'t connect to reCaptcha server')); 30 42 } 31 43 } … … 36 48 foreach (array('captcha_publickey','captcha_privatekey', 'captcha_theme') as $param) 37 49 { 38 $q = ' 39 DELETE FROM '.CONFIG_TABLE.' WHERE param="'.$param.'" LIMIT 1'; 50 $q = 'DELETE FROM '.CONFIG_TABLE.' WHERE param="'.$param.'" LIMIT 1'; 40 51 pwg_query( $q ); 41 52 }
Note: See TracChangeset
for help on using the changeset viewer.