Ignore:
Timestamp:
Dec 21, 2013, 6:37:54 PM (10 years ago)
Author:
mistic100
Message:

try to simplify integration of captchas

File:
1 edited

Legend:

Unmodified
Added
Removed
  • extensions/EasyCaptcha/main.inc.php

    r26025 r26069  
    3232{
    3333  add_event_handler('loc_end_section_init', 'easycaptcha_document_init', EVENT_HANDLER_PRIORITY_NEUTRAL+30);
     34  add_event_handler('loc_begin_register', 'easycaptcha_register_init', EVENT_HANDLER_PRIORITY_NEUTRAL+30);
    3435}
    3536
     
    5960  }
    6061
    61   if (script_basename() == 'register' && $conf['EasyCaptcha']['activate_on']['register'])
     62  if (script_basename() == 'picture' && $conf['EasyCaptcha']['activate_on']['picture'])
    6263  {
    63     $conf['EasyCaptcha']['template'] = 'register';
    64     include(EASYCAPTCHA_PATH . 'include/register.inc.php');
    65   }
    66   else if (script_basename() == 'picture' && $conf['EasyCaptcha']['activate_on']['picture'])
    67   {
    68     $conf['EasyCaptcha']['template'] = 'comment';
    6964    include(EASYCAPTCHA_PATH . 'include/picture.inc.php');
    7065  }
     
    7873      )
    7974    {
    80       $conf['EasyCaptcha']['template'] = 'comment';
    8175      include(EASYCAPTCHA_PATH . 'include/category.inc.php');
    8276    }
    8377    else if ($page['section'] == 'contact' && $conf['EasyCaptcha']['activate_on']['contactform'])
    8478    {
    85       $conf['EasyCaptcha']['template'] = 'contactform';
    8679      include(EASYCAPTCHA_PATH . 'include/contactform.inc.php');
    8780    }
    8881    else if ($page['section'] == 'guestbook' && $conf['EasyCaptcha']['activate_on']['guestbook'])
    8982    {
    90       $conf['EasyCaptcha']['template'] = 'guestbook';
    9183      include(EASYCAPTCHA_PATH . 'include/guestbook.inc.php');
    9284    }
     85  }
     86}
     87function easycaptcha_register_init()
     88{
     89  global $conf;
     90
     91  if (!is_a_guest())
     92  {
     93    return;
     94  }
     95
     96  if ($conf['EasyCaptcha']['activate_on']['register'])
     97  {
     98    include(EASYCAPTCHA_PATH . 'include/register.inc.php');
    9399  }
    94100}
Note: See TracChangeset for help on using the changeset viewer.