[10837] | 1 | <?php |
---|
| 2 | /* |
---|
[11375] | 3 | Plugin Name: Crypto Captcha |
---|
[10837] | 4 | Version: auto |
---|
[12617] | 5 | Description: Add a captcha to register, comment and ContactForm pages (thanks to P@t) |
---|
[10839] | 6 | Plugin URI: http://piwigo.org/ext/extension_view.php?eid=535 |
---|
[10837] | 7 | Author: Mistic |
---|
| 8 | Author URI: http://www.strangeplanet.fr |
---|
| 9 | */ |
---|
| 10 | |
---|
[12617] | 11 | ## TODO : add customization of background image |
---|
| 12 | |
---|
| 13 | /* |
---|
| 14 | Author note : |
---|
| 15 | Le plugin était appellé à l'origine CryptograPHP et utilisait la librairie CryptograPHP |
---|
| 16 | Puis il a été renommé Crypto Captcha pour plus de clareté |
---|
| 17 | La version actuelle s'appelle toujours Crypto Captcha mais utilise la librairie Securimage |
---|
| 18 | */ |
---|
| 19 | |
---|
[10837] | 20 | if (!defined('PHPWG_ROOT_PATH')) die('Hacking attempt!'); |
---|
| 21 | define('CRYPTO_PATH' , PHPWG_PLUGINS_PATH . basename(dirname(__FILE__)) . '/'); |
---|
| 22 | |
---|
[12619] | 23 | add_event_handler('init', 'crypto_init'); |
---|
| 24 | add_event_handler('loc_end_section_init', 'crypto_section_init'); |
---|
[10837] | 25 | |
---|
| 26 | function crypto_init() |
---|
| 27 | { |
---|
[12619] | 28 | global $conf, $user; |
---|
[11316] | 29 | |
---|
[12617] | 30 | $conf['cryptographp'] = unserialize($conf['cryptographp']); |
---|
| 31 | load_language('plugin.lang', CRYPTO_PATH); |
---|
| 32 | |
---|
[11316] | 33 | if (script_basename() == 'register') |
---|
| 34 | { |
---|
| 35 | include(CRYPTO_PATH.'include/register.inc.php'); |
---|
| 36 | } |
---|
[12617] | 37 | else if (script_basename() == 'picture' and $conf['cryptographp']['comments_action'] != 'inactive') |
---|
[11316] | 38 | { |
---|
| 39 | include(CRYPTO_PATH.'include/picture.inc.php'); |
---|
| 40 | } |
---|
[12619] | 41 | // because of ContactForm specificities, Captcha can't be displayed on these themes |
---|
| 42 | else if ( isset($_GET['/contact']) and strstr($user['theme'], 'simple') === false and strstr($user['theme'], 'stripped') === false ) |
---|
[11316] | 43 | { |
---|
| 44 | include(CRYPTO_PATH.'include/contactform.inc.php'); |
---|
| 45 | } |
---|
[12619] | 46 | } |
---|
| 47 | |
---|
| 48 | function crypto_section_init() |
---|
| 49 | { |
---|
| 50 | global $conf, $pwg_loaded_plugins, $page; |
---|
| 51 | |
---|
| 52 | if ( |
---|
[12617] | 53 | script_basename() == 'index' and $conf['cryptographp']['comments_action'] != 'inactive' and |
---|
| 54 | isset($pwg_loaded_plugins['Comments_on_Albums']) and isset($page['section']) and |
---|
| 55 | $page['section'] == 'categories' and isset($page['category']) |
---|
| 56 | ) |
---|
| 57 | { |
---|
| 58 | include(CRYPTO_PATH.'include/category.inc.php'); |
---|
| 59 | } |
---|
[10837] | 60 | } |
---|
| 61 | |
---|
[11316] | 62 | if (script_basename() == 'admin') |
---|
| 63 | { |
---|
[11370] | 64 | add_event_handler('get_admin_plugin_menu_links', 'crypto_plugin_admin_menu'); |
---|
[11316] | 65 | |
---|
[11370] | 66 | function crypto_plugin_admin_menu($menu) |
---|
| 67 | { |
---|
[12617] | 68 | array_push($menu, array( |
---|
| 69 | 'NAME' => 'Crypto Captcha', |
---|
| 70 | 'URL' => get_root_url().'admin.php?page=plugin-'.basename(dirname(__FILE__)) |
---|
| 71 | )); |
---|
[11370] | 72 | return $menu; |
---|
| 73 | } |
---|
[10837] | 74 | } |
---|
| 75 | |
---|
| 76 | ?> |
---|