[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 | |
---|
[14527] | 30 | // brace yourself, smartphones spammers are comming ! |
---|
| 31 | if ($user['theme'] == 'smartpocket') return; |
---|
| 32 | |
---|
[12617] | 33 | $conf['cryptographp'] = unserialize($conf['cryptographp']); |
---|
| 34 | |
---|
[15996] | 35 | if (script_basename() == 'register' and $conf['cryptographp']['activate_on']['register']) |
---|
[11316] | 36 | { |
---|
| 37 | include(CRYPTO_PATH.'include/register.inc.php'); |
---|
| 38 | } |
---|
[15996] | 39 | else if (script_basename() == 'picture' and $conf['cryptographp']['activate_on']['picture']) |
---|
[11316] | 40 | { |
---|
| 41 | include(CRYPTO_PATH.'include/picture.inc.php'); |
---|
| 42 | } |
---|
[15996] | 43 | else if (isset($_GET['/contact']) and $conf['cryptographp']['activate_on']['contactform']) |
---|
[11316] | 44 | { |
---|
| 45 | include(CRYPTO_PATH.'include/contactform.inc.php'); |
---|
| 46 | } |
---|
[15996] | 47 | else if (isset($_GET['/guestbook']) and $conf['cryptographp']['activate_on']['guestbook']) |
---|
| 48 | { |
---|
| 49 | include(CRYPTO_PATH.'include/guestbook.inc.php'); |
---|
| 50 | } |
---|
[12619] | 51 | } |
---|
| 52 | |
---|
| 53 | function crypto_section_init() |
---|
| 54 | { |
---|
[15996] | 55 | global $conf, $pwg_loaded_plugins, $page, $user; |
---|
[12619] | 56 | |
---|
[15996] | 57 | if ($user['theme'] == 'smartpocket') return; |
---|
| 58 | |
---|
[12619] | 59 | if ( |
---|
[15996] | 60 | script_basename() == 'index' and $conf['cryptographp']['activate_on']['category'] and |
---|
[12617] | 61 | isset($pwg_loaded_plugins['Comments_on_Albums']) and isset($page['section']) and |
---|
| 62 | $page['section'] == 'categories' and isset($page['category']) |
---|
| 63 | ) |
---|
| 64 | { |
---|
| 65 | include(CRYPTO_PATH.'include/category.inc.php'); |
---|
| 66 | } |
---|
[10837] | 67 | } |
---|
| 68 | |
---|
[11316] | 69 | if (script_basename() == 'admin') |
---|
| 70 | { |
---|
[11370] | 71 | add_event_handler('get_admin_plugin_menu_links', 'crypto_plugin_admin_menu'); |
---|
[11316] | 72 | |
---|
[11370] | 73 | function crypto_plugin_admin_menu($menu) |
---|
| 74 | { |
---|
[12617] | 75 | array_push($menu, array( |
---|
| 76 | 'NAME' => 'Crypto Captcha', |
---|
| 77 | 'URL' => get_root_url().'admin.php?page=plugin-'.basename(dirname(__FILE__)) |
---|
| 78 | )); |
---|
[11370] | 79 | return $menu; |
---|
| 80 | } |
---|
[10837] | 81 | } |
---|
| 82 | |
---|
| 83 | ?> |
---|