source: extensions/CryptograPHP/main.inc.php @ 15907

Revision 14527, 2.1 KB checked in by mistic100, 8 years ago (diff)

update for 2.4
deactivated for smartpocket, now compatible with simple and stripped on ContactForm
live update of preview on admin page

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