1 | <?php |
---|
2 | /* |
---|
3 | Plugin Name: LCAS |
---|
4 | Version: 2.1.0 |
---|
5 | Description: Allow to disable login/register name to be sensible to the case/accents |
---|
6 | Plugin URI: http://fr.piwigo.org/forum/viewtopic.php?pid=158563 |
---|
7 | Author: Eric, LucMorizur, Whiler |
---|
8 | Author URI: http://www.infernoweb.net, http://blogs.wittwer.fr/whiler/ |
---|
9 | */ |
---|
10 | |
---|
11 | /* History: LCAS_PATH.'Changelog.txt.php' */ |
---|
12 | |
---|
13 | /* |
---|
14 | ***** TODO List ***** |
---|
15 | See project bugtracker: http://piwigo.org/bugs/my_view_page.php |
---|
16 | */ |
---|
17 | |
---|
18 | if (!defined('PHPWG_ROOT_PATH')) die('Hacking attempt!'); |
---|
19 | if (!defined('LCAS_DIR')) define('LCAS_DIR' , basename(dirname(__FILE__))); |
---|
20 | if (!defined('LCAS_PATH')) define('LCAS_PATH' , PHPWG_PLUGINS_PATH.basename(dirname(__FILE__)).'/'); |
---|
21 | |
---|
22 | include_once (LCAS_PATH.'include/constants.php'); |
---|
23 | include_once (LCAS_PATH.'include/functions.inc.php'); |
---|
24 | |
---|
25 | load_language('plugin.lang', LCAS_PATH); |
---|
26 | |
---|
27 | |
---|
28 | /* Plugin admin */ |
---|
29 | add_event_handler('get_admin_plugin_menu_links', 'LCAS_admin_menu'); |
---|
30 | |
---|
31 | function LCAS_admin_menu($menu) |
---|
32 | { |
---|
33 | // +-----------------------------------------------------------------------+ |
---|
34 | // | Getting plugin name | |
---|
35 | // +-----------------------------------------------------------------------+ |
---|
36 | $plugin = LCAS_PluginInfos(LCAS_PATH); |
---|
37 | $name = $plugin['name']; |
---|
38 | |
---|
39 | array_push($menu, |
---|
40 | array( |
---|
41 | 'NAME' => $name, |
---|
42 | 'URL' => get_admin_plugin_menu_link(LCAS_PATH.'/admin/LCAS_admin.php') |
---|
43 | ) |
---|
44 | ); |
---|
45 | |
---|
46 | return $menu; |
---|
47 | } |
---|
48 | |
---|
49 | add_event_handler('init', 'LCAS_InitPage'); |
---|
50 | |
---|
51 | function LCAS_InitPage() |
---|
52 | { |
---|
53 | global $conf; |
---|
54 | |
---|
55 | $conf_LCAS= unserialize($conf['LoginCaseAccentsSensitivity']); |
---|
56 | |
---|
57 | /* User identification */ |
---|
58 | if (script_basename() == 'identification') |
---|
59 | { |
---|
60 | if (isset($_POST['username'])) |
---|
61 | { |
---|
62 | /* User non case sensitive */ |
---|
63 | if (isset($conf_LCAS[0]) and $conf_LCAS[0] == 'false') |
---|
64 | { |
---|
65 | $new_username = LCAS_SearchUsername($_POST['username']); // Testing still under progress - This is not fully functionnal ! |
---|
66 | $_POST['username'] = $new_username == '' ? $_POST['username'] : $new_username; |
---|
67 | } |
---|
68 | } |
---|
69 | } |
---|
70 | } |
---|
71 | ?> |
---|