Changeset 8034 for extensions/captcha


Ignore:
Timestamp:
Dec 8, 2010, 1:53:36 PM (10 years ago)
Author:
patdenice
Message:

Display corrected in IE8.
Add theme interface select in admin pannel.

Location:
extensions/captcha
Files:
9 edited

Legend:

Unmodified
Added
Removed
  • extensions/captcha/admin.php

    r8030 r8034  
    77if ( isset($_POST['submit']) and !is_adviser() )
    88{
    9   $conf['captcha_publickey'] = trim($_POST['captcha_publickey']);
    10   $conf['captcha_privatekey'] = trim($_POST['captcha_privatekey']);
     9  foreach (array('captcha_publickey', 'captcha_privatekey', 'captcha_theme') as $field)
     10  {
     11    $conf[$field] = trim($_POST[$field]);
    1112
    12   $query = '
     13    $query = '
    1314UPDATE '.CONFIG_TABLE.'
    14   SET value="'.$conf['captcha_publickey'].'"
    15   WHERE param="captcha_publickey"
     15  SET value="'.$conf[$field].'"
     16  WHERE param="'.$field.'"
    1617  LIMIT 1';
    17   pwg_query($query);
    18 
    19   $query = '
    20 UPDATE '.CONFIG_TABLE.'
    21   SET value="'.$conf['captcha_privatekey'].'"
    22   WHERE param="captcha_privatekey"
    23   LIMIT 1';
    24   pwg_query($query);
     18    pwg_query($query);
     19  }
    2520
    2621  array_push($page['infos'], l10n('Information data registered in database'));
     
    3227  'CAPTCHA_PUBLICKEY' => $conf['captcha_publickey'],
    3328  'CAPTCHA_PRIVATEKEY' => $conf['captcha_privatekey'],
    34   'reCAPTCHA_URL' => recaptcha_get_signup_url (urlencode($_SERVER['SERVER_NAME']), 'Piwigo')
     29  'reCAPTCHA_URL' => recaptcha_get_signup_url(urlencode($_SERVER['SERVER_NAME']), 'Piwigo'),
     30  'captcha_theme_options' => array('red', 'white', 'blackglass'),
     31  'captcha_theme_selected' => $conf['captcha_theme'],
    3532  )
    3633);
  • extensions/captcha/admin.tpl

    r8030 r8034  
    1010  <li>
    1111  <label>
    12     {'Public Key:'|@translate}
    13     <input type="text" size="48" name="captcha_publickey" value="{$CAPTCHA_PUBLICKEY}" />
     12    {'Public Key'|@translate}:
     13    <input type="text" size="52" name="captcha_publickey" value="{$CAPTCHA_PUBLICKEY}" />
    1414  </label>
    1515  </li>
    1616  <li>
    1717  <label>
    18     {'Private Key:'|@translate}
    19     <input type="text" size="48" name="captcha_privatekey" value="{$CAPTCHA_PRIVATEKEY}" />
     18    {'Private Key'|@translate}:
     19    <input type="text" size="52" name="captcha_privatekey" value="{$CAPTCHA_PRIVATEKEY}" />
     20  </label>
     21  </li>
     22  <li>
     23  <label>
     24    {'Interface theme'|@translate}:
     25    {html_options name=captcha_theme values=$captcha_theme_options output=$captcha_theme_options selected=$captcha_theme_selected}
    2026  </label>
    2127  </li>
     
    2329    <br/><a href="{$reCAPTCHA_URL}" target="_blank">{'Signup for personal usage keys'|@translate}</a>
    2430  </li>
    25  
     31
    2632  <p class="bottomButtons">
    2733    <input class="submit" type="submit" value="{'Submit'|@translate}" name="submit" {$TAG_INPUT_ENABLED}/>
  • extensions/captcha/captcha.tpl

    r8031 r8034  
    11{html_head}
    22<script type= "text/javascript">
    3 var RecaptchaOptions = {ldelim} theme: "white", lang : "{$lang_info.code}" };
     3var RecaptchaOptions = {ldelim} theme: "{$CAPTCHA_THEME}", lang : "{$lang_info.code}" };
    44</script>
    5 <style type="text/css">#recaptcha_area {ldelim} margin: 25px auto; }</style>
     5<style type="text/css">
     6#recaptcha_area {ldelim} margin: 20px auto; }
     7#recaptcha_area a {ldelim} border:0 none; }
     8</style>
    69{/html_head}
    710
  • extensions/captcha/language/de_DE/plugin.lang.php

    r8032 r8034  
    22
    33$lang['Captcha Configuration'] = 'Captcha Konfiguration';
    4 $lang['Public Key:'] = 'Öffentlicher Key:';
    5 $lang['Private Key:'] = 'Privater Key:';
     4$lang['Public Key'] = 'Öffentlicher Key';
     5$lang['Private Key'] = 'Privater Key';
    66$lang['Signup for personal usage keys'] = 'Registrieren Sie sich um Ihre persönliche Keys zu erhalten';
    77
  • extensions/captcha/language/en_UK/plugin.lang.php

    r8030 r8034  
    22
    33$lang['Captcha Configuration'] = 'Captcha Configuration';
    4 $lang['Public Key:'] = 'Public Key:';
    5 $lang['Private Key:'] = 'Private Key:';
     4$lang['Public Key'] = 'Public Key';
     5$lang['Private Key'] = 'Private Key';
    66$lang['Signup for personal usage keys'] = 'Signup for personal usage keys';
    77
  • extensions/captcha/language/fr_FR/plugin.lang.php

    r8030 r8034  
    22
    33$lang['Captcha Configuration'] = 'Configuration du Captcha';
    4 $lang['Public Key:'] = 'Clef publique:';
    5 $lang['Private Key:'] = 'Cléf privée:';
     4$lang['Public Key'] = 'Clef publique';
     5$lang['Private Key'] = 'Cléf privée';
    66$lang['Signup for personal usage keys'] = 'Enregistrer ses clefs personelles';
    77
  • extensions/captcha/language/it_IT/plugin.lang.php

    r8032 r8034  
    22
    33$lang['Captcha Configuration'] = 'Configurazione del captcha';
    4 $lang['Public Key:'] = 'Chiave pubblica:';
    5 $lang['Private Key:'] = 'Chiave privata:';
     4$lang['Public Key'] = 'Chiave pubblica';
     5$lang['Private Key'] = 'Chiave privata';
    66$lang['Signup for personal usage keys'] = 'Iscriversi per le chiavi di uso personale';
    77
  • extensions/captcha/main.inc.php

    r8031 r8034  
    2222  add_event_handler('register_user_check', 'check_captcha');
    2323}
    24 
    25 if (script_basename() == 'admin')
     24elseif (script_basename() == 'admin')
    2625{
    2726  add_event_handler('get_admin_plugin_menu_links', 'captcha_plugin_admin_menu' );
     
    3433  $template->set_prefilter('register', 'captcha_prefilter');
    3534  $template->set_filename('captcha', realpath(CAPTCHA_PATH.'captcha.tpl'));
    36   $template->assign('CAPTCHA_HTML', recaptcha_get_html($conf['captcha_publickey'], get_plugin_data('captcha')));
     35  $template->assign(array(
     36    'CAPTCHA_HTML'  => recaptcha_get_html($conf['captcha_publickey'], get_plugin_data('captcha')),
     37    'CAPTCHA_THEME' => $conf['captcha_theme'],
     38    )
     39  );
    3740  $template->assign_var_from_handle('CAPTCHA', 'captcha');
    3841}
     
    4144{
    4245  $search = '<p class="bottomButtons">';
    43   $captcha = '{$CAPTCHA}';
    44 
    45   return str_replace($search, $captcha."\n".$search, $content);
     46  return str_replace($search, '{$CAPTCHA}'."\n".$search, $content);
    4647}
    4748
  • extensions/captcha/maintain.inc.php

    r8030 r8034  
    1616}
    1717
     18function plugin_activate()
     19{
     20  global $conf;
     21
     22  if (!isset($conf['captcha_theme']))
     23  {
     24    $q = '
     25INSERT INTO '.CONFIG_TABLE.' (param,value,comment)
     26  VALUES
     27  ("captcha_theme","red","Captcha theme")
     28;';
     29    pwg_query($q);
     30  }
     31}
     32
    1833
    1934function plugin_uninstall()
    2035{
    21   foreach (array('captcha_publickey','captcha_privatekey') as $param)
     36  foreach (array('captcha_publickey','captcha_privatekey', 'captcha_theme') as $param)
    2237  {
    2338    $q = '
Note: See TracChangeset for help on using the changeset viewer.