1 | <?php |
---|
2 | /* |
---|
3 | Plugin Name: LCAS |
---|
4 | Version: 0.0.1 |
---|
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: Nicco, Eric, LucMorizur, Whiler |
---|
8 | Author URI: http://gallery-nicco.no-ip.org, 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 | /* User creation */ |
---|
50 | add_event_handler('register_user', 'LCAS_Adduser'); |
---|
51 | |
---|
52 | function LCAS_Adduser($register_user) |
---|
53 | { |
---|
54 | global $conf; |
---|
55 | |
---|
56 | $conf_LCAS= unserialize($conf['LoginCaseAccentsSensitivity']); |
---|
57 | |
---|
58 | } |
---|
59 | |
---|
60 | |
---|
61 | /* User deletion */ |
---|
62 | add_event_handler('delete_user', 'LCAS_Deluser'); |
---|
63 | |
---|
64 | function LCAS_Deluser($user_id) |
---|
65 | { |
---|
66 | |
---|
67 | } |
---|
68 | |
---|
69 | |
---|
70 | // Check users registration |
---|
71 | add_event_handler('register_user_check', 'LCAS_RegistrationCheck', EVENT_HANDLER_PRIORITY_NEUTRAL, 2); |
---|
72 | |
---|
73 | function LCAS_RegistrationCheck($errors, $user) |
---|
74 | { |
---|
75 | global $conf; |
---|
76 | |
---|
77 | } |
---|
78 | |
---|
79 | |
---|
80 | if (script_basename() == 'profile') |
---|
81 | { |
---|
82 | add_event_handler('loc_begin_profile', 'LCAS_Profile_Init'); |
---|
83 | |
---|
84 | function LCAS_Profile_Init() |
---|
85 | { |
---|
86 | |
---|
87 | } |
---|
88 | } |
---|
89 | |
---|
90 | |
---|
91 | // RedirectToProfile - Thx to LucMorizur |
---|
92 | // redirects a visitor (except for admins, webmasters and generic statuses) to his |
---|
93 | // profile.php page |
---|
94 | // |
---|
95 | // no variable, no return |
---|
96 | add_event_handler('login_success', 'LCAS_RedirectToProfile'); |
---|
97 | |
---|
98 | function LCAS_RedirectToProfile() |
---|
99 | { |
---|
100 | global $conf, $user; |
---|
101 | |
---|
102 | $conf_LCAS= unserialize($conf['LoginCaseAccentsSensitivity']); |
---|
103 | |
---|
104 | $query =' |
---|
105 | SELECT user_id, status |
---|
106 | FROM '.USER_INFOS_TABLE.' |
---|
107 | WHERE user_id = '.$user['id'].' |
---|
108 | ;'; |
---|
109 | $data = pwg_db_fetch_assoc(pwg_query($query)); |
---|
110 | |
---|
111 | if ($data['status'] <> "admin" and $data['status'] <> "webmaster" and $data['status'] <> "generic") |
---|
112 | { |
---|
113 | if ((isset($conf_LCAS[21]) and $conf_LCAS[21] == 'true')) |
---|
114 | { |
---|
115 | $user_idsOK = array(); |
---|
116 | if (!check_consult($user['id'], $user_idsOK)) |
---|
117 | redirect(PHPWG_ROOT_PATH.'profile.php'); |
---|
118 | } |
---|
119 | } |
---|
120 | } |
---|
121 | |
---|
122 | |
---|
123 | add_event_handler('init', 'LCAS_InitPage'); |
---|
124 | /* *** Important ! This is necessary to make email exclusion work in admin's users management panel *** */ |
---|
125 | function LCAS_InitPage() |
---|
126 | { |
---|
127 | load_language('plugin.lang', LCAS_PATH); |
---|
128 | global $conf, $template, $page, $lang, $errors; |
---|
129 | |
---|
130 | $conf_LCAS= unserialize($conf['LoginCaseAccentsSensitivity']); |
---|
131 | |
---|
132 | /* Admin user management */ |
---|
133 | if (script_basename() == 'admin' and isset($_GET['page']) and $_GET['page'] == 'user_list') |
---|
134 | { |
---|
135 | if (isset($_POST['submit_add'])) |
---|
136 | { |
---|
137 | |
---|
138 | } |
---|
139 | } |
---|
140 | } |
---|
141 | |
---|
142 | ?> |
---|