Ignore:
Timestamp:
Nov 13, 2011, 12:34:07 AM (12 years ago)
Author:
mistic100
Message:

rewrite some prefilters, replace CryptograPHP by Securimage (not abandoned project!)

File:
1 edited

Legend:

Unmodified
Added
Removed
  • extensions/CryptograPHP/include/register.inc.php

    r11370 r12617  
    11<?php
    2 
    32if (!defined('PHPWG_ROOT_PATH')) die('Hacking attempt!');
    4 
    5 $cryptinstall = CRYPTO_PATH.'cryptographp/cryptographp.fct.php';
    6 include($cryptinstall);
    73
    84add_event_handler('loc_end_page_header', 'add_crypto');
     
    117function add_crypto()
    128{
    13   global $template, $conf;
     9  global $template;
    1410
    1511  $template->set_prefilter('register', 'prefilter_crypto');
    16   $template->assign('CAPTCHA', dsp_crypt($conf['cryptographp_theme'][0].'.cfg.php',1));
    1712}
    1813
    1914function prefilter_crypto($content, $smarty)
    2015{
    21   load_language('plugin.lang', CRYPTO_PATH);
     16  global $conf;
    2217 
    23   $search = '<p class="bottomButtons">';
     18  $search = '#\<\/ul\>(.{0,10})\<\/fieldset\>(.{0,10})\<p class\=\"bottomButtons\"\>#is';
    2419  $replace = '
    25   <fieldset>
    26     <legend>{\'Antibot test\'|@translate}</legend>
    27     <ul>
    2820      <li>
    2921        <span class="property">
    30           <label>{$CAPTCHA}</label>
     22          <label><img id="captcha" src="'.CRYPTO_PATH.'securimage/securimage_show.php" alt="CAPTCHA Image"></label>
    3123        </span>
    32         <input type="text" name="code">
     24        <b>{\''.($conf['cryptographp']['captcha_type']=='string'?'Enter code':'Solve equation').'\'|@translate} :</b><br>
     25        <input type="text" name="captcha_code" size="'.($conf['cryptographp']['code_length']+1).'" maxlength="'.$conf['cryptographp']['code_length'].'" />
     26        <a href="#" onclick="document.getElementById(\'captcha\').src = \''.CRYPTO_PATH.'securimage/securimage_show.php?\' + Math.random(); return false">
     27          <img src="'.CRYPTO_PATH.'template/refresh.png"></a>
    3328      </li>
    34     </ul>
    35   </fieldset>'
    36 ."\n".$search;
     29  </ul>
    3730
    38   return str_replace($search, $replace, $content);
     31  </fieldset>
     32
     33  <p class="bottomButtons">';
     34
     35  return preg_replace($search, $replace, $content);
    3936}
    4037
    4138function check_crypto($errors)
    4239{
    43   if (!chk_crypt($_POST['code']))
     40  include_once(CRYPTO_PATH.'securimage/securimage.php');
     41  $securimage = new Securimage();
     42 
     43  if ($securimage->check($_POST['captcha_code']) == false)
    4444  {
    45     load_language('plugin.lang', CRYPTO_PATH);
    4645    array_push($errors, l10n('Invalid Captcha'));
    4746  }
Note: See TracChangeset for help on using the changeset viewer.