Changeset 8054 for extensions/captcha


Ignore:
Timestamp:
12/09/10 12:49:42 (9 years ago)
Author:
patdenice
Message:

Check if reCaptcha API is responding before activate.

Location:
extensions/captcha
Files:
10 edited

Legend:

Unmodified
Added
Removed
  • extensions/captcha/language/de_DE/plugin.lang.php

    r8034 r8054  
    88$lang['Invalid Captcha'] = 'Captcha ist ungültig'; 
    99$lang['You need to define Captcha keys'] = 'Sie müssen die Captcha Keys bestimmen'; 
     10/*TODO*/$lang['Piwigo can\'t connect to reCaptcha server'] = 'Piwigo can\'t connect to reCaptcha server'; 
    1011 
    1112?> 
  • extensions/captcha/language/en_UK/plugin.lang.php

    r8034 r8054  
    88$lang['Invalid Captcha'] = 'Invalid Captcha'; 
    99$lang['You need to define Captcha keys'] = 'You need to define Captcha keys'; 
     10$lang['Piwigo can\'t connect to reCaptcha server'] = 'Piwigo can\'t connect to reCaptcha server'; 
    1011 
    1112?> 
  • extensions/captcha/language/es_ES/plugin.lang.php

    r8038 r8054  
    88$lang['Invalid Captcha'] = 'Captcha no valido'; 
    99$lang['You need to define Captcha keys'] = 'Necesita definir sus llaces Captcha'; 
     10/*TODO*/$lang['Piwigo can\'t connect to reCaptcha server'] = 'Piwigo can\'t connect to reCaptcha server'; 
    1011 
    1112?> 
  • extensions/captcha/language/fr_FR/plugin.lang.php

    r8034 r8054  
    88$lang['Invalid Captcha'] = 'Captcha non valide'; 
    99$lang['You need to define Captcha keys'] = 'Vous avez besoins de définir vos clefs Captcha'; 
     10$lang['Piwigo can\'t connect to reCaptcha server'] = 'Piwigo ne peut pas se connecter au serveur de reCaptcha'; 
    1011 
    1112?> 
  • extensions/captcha/language/it_IT/plugin.lang.php

    r8040 r8054  
    88$lang['Invalid Captcha'] = 'Captcha non valido'; 
    99$lang['You need to define Captcha keys'] = 'È necessario definire le chiavi per il Captcha'; 
     10/*TODO*/$lang['Piwigo can\'t connect to reCaptcha server'] = 'Piwigo can\'t connect to reCaptcha server'; 
    1011 
    1112?> 
  • extensions/captcha/language/lv_LV/plugin.lang.php

    r8037 r8054  
    88$lang['Invalid Captcha'] = 'Nekorekts autentifikators Cptcha'; 
    99$lang['You need to define Captcha keys'] = 'Jums jādefinē autentifikatora Captcha atslēgas'; 
     10/*TODO*/$lang['Piwigo can\'t connect to reCaptcha server'] = 'Piwigo can\'t connect to reCaptcha server'; 
    1011 
    1112?> 
  • extensions/captcha/language/nl_NL/plugin.lang.php

    r8053 r8054  
    88$lang['Invalid Captcha'] = 'Ongeldige Captcha'; 
    99$lang['You need to define Captcha keys'] = 'U dient eerst Captcha sleutels aan te maken'; 
     10/*TODO*/$lang['Piwigo can\'t connect to reCaptcha server'] = 'Piwigo can\'t connect to reCaptcha server'; 
    1011 
    1112?> 
  • extensions/captcha/language/ru_RU/plugin.lang.php

    r8051 r8054  
    88$lang['Invalid Captcha'] = 'Некорректный ввод Captcha'; 
    99$lang['You need to define Captcha keys'] = 'Вам нужно ввести ключи Captcha'; 
     10/*TODO*/$lang['Piwigo can\'t connect to reCaptcha server'] = 'Piwigo can\'t connect to reCaptcha server'; 
    1011 
    1112?> 
  • extensions/captcha/language/sk_SK/plugin.lang.php

    r8052 r8054  
    88$lang['Invalid Captcha'] = 'Nesprávne Captcha'; 
    99$lang['You need to define Captcha keys'] = 'Musíte definovať Captcha kľúče'; 
     10/*TODO*/$lang['Piwigo can\'t connect to reCaptcha server'] = 'Piwigo can\'t connect to reCaptcha server'; 
    1011 
    1112?> 
  • extensions/captcha/maintain.inc.php

    r8034 r8054  
    22function plugin_install() 
    33{ 
    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  } 
    1623} 
    1724 
    18 function plugin_activate() 
     25function plugin_activate($id, $version, &$errors) 
    1926{ 
    2027  global $conf; 
     
    2229  if (!isset($conf['captcha_theme'])) 
    2330  { 
    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')); 
    3042  } 
    3143} 
     
    3648  foreach (array('captcha_publickey','captcha_privatekey', 'captcha_theme') as $param) 
    3749  { 
    38     $q = ' 
    39 DELETE FROM '.CONFIG_TABLE.' WHERE param="'.$param.'" LIMIT 1'; 
     50    $q = 'DELETE FROM '.CONFIG_TABLE.' WHERE param="'.$param.'" LIMIT 1'; 
    4051    pwg_query( $q ); 
    4152  } 
Note: See TracChangeset for help on using the changeset viewer.