Last change
on this file since 8888 was
8888,
checked in by patdenice, 14 years ago
|
Add captcha to contactform (if installed).
|
File size:
1.1 KB
|
Line | |
---|
1 | <?php |
---|
2 | /* |
---|
3 | Plugin Name: Captcha |
---|
4 | Version: auto |
---|
5 | Description: Add captcha to registration form |
---|
6 | Plugin URI: auto |
---|
7 | Author: P@t |
---|
8 | Author URI: http://piwigo.org |
---|
9 | */ |
---|
10 | |
---|
11 | if (!defined('PHPWG_ROOT_PATH')) die('Hacking attempt!'); |
---|
12 | define('CAPTCHA_PATH' , PHPWG_PLUGINS_PATH . basename(dirname(__FILE__)) . '/'); |
---|
13 | |
---|
14 | global $conf; |
---|
15 | |
---|
16 | if (!empty($conf['captcha_publickey']) and !empty($conf['captcha_privatekey'])) |
---|
17 | { |
---|
18 | if (script_basename() == 'register') include('register.inc.php'); |
---|
19 | elseif (isset($_GET['/contact'])) include('contactform.inc.php'); |
---|
20 | } |
---|
21 | |
---|
22 | if (script_basename() == 'admin') |
---|
23 | add_event_handler('get_admin_plugin_menu_links', 'captcha_plugin_admin_menu' ); |
---|
24 | |
---|
25 | function captcha_plugin_admin_menu($menu) |
---|
26 | { |
---|
27 | global $page,$conf; |
---|
28 | |
---|
29 | if ( (empty($conf['captcha_publickey']) or empty($conf['captcha_publickey'])) |
---|
30 | and in_array($page['page'], array('intro','plugins_list')) ) |
---|
31 | { |
---|
32 | load_language('plugin.lang', CAPTCHA_PATH); |
---|
33 | $page['errors'][] = l10n('You need to define Captcha keys'); |
---|
34 | } |
---|
35 | |
---|
36 | array_push($menu, |
---|
37 | array( |
---|
38 | 'NAME' => 'Captcha', |
---|
39 | 'URL' => get_admin_plugin_menu_link(dirname(__FILE__).'/admin.php') |
---|
40 | ) |
---|
41 | ); |
---|
42 | return $menu; |
---|
43 | } |
---|
44 | |
---|
45 | ?> |
---|
Note: See
TracBrowser
for help on using the repository browser.