source: extensions/captcha/main.inc.php @ 32022

Last change on this file since 32022 was 9986, checked in by patdenice, 13 years ago

Clean URL for 2.2.x

File size: 1.1 KB
Line 
1<?php
2/*
3Plugin Name: Captcha
4Version: auto
5Description: Add captcha to registration form
6Plugin URI: auto
7Author: P@t
8Author URI: http://piwigo.org
9*/
10
11if (!defined('PHPWG_ROOT_PATH')) die('Hacking attempt!');
12define('CAPTCHA_PATH' , PHPWG_PLUGINS_PATH . basename(dirname(__FILE__)) . '/');
13
14global $conf;
15
16if (!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
22if (script_basename() == 'admin')
23  add_event_handler('get_admin_plugin_menu_links', 'captcha_plugin_admin_menu' );
24
25function 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_root_url().'admin.php?page=plugin-'.basename(dirname(__FILE__))
40                        )
41                );
42        return $menu;
43}
44
45?>
Note: See TracBrowser for help on using the repository browser.