source: extensions/LCAS/trunk/admin/LCAS_admin.php @ 8148

Last change on this file since 8148 was 8148, checked in by Whiler, 13 years ago

Display $confinsensitive_case_logon value in the plugin admin page

File size: 9.7 KB
Line 
1<?php
2
3global $user, $lang, $conf, $errors;
4
5if (!defined('PHPWG_ROOT_PATH')) die('Hacking attempt!');
6// +-----------------------------------------------------------------------+
7// | Check Access and exit when user status is not ok                      |
8// +-----------------------------------------------------------------------+
9check_status(ACCESS_ADMINISTRATOR);
10
11if (!defined('LCAS_PATH')) define('LCAS_PATH' , PHPWG_PLUGINS_PATH.basename(dirname(__FILE__)).'/');
12
13//ini_set('error_reporting', E_ALL);
14//ini_set('display_errors', true);
15
16include_once(PHPWG_ROOT_PATH.'admin/include/tabsheet.class.php');
17include_once (PHPWG_ROOT_PATH.'/include/constants.php');
18$my_base_url = get_admin_plugin_menu_link(__FILE__);
19
20load_language('plugin.lang', LCAS_PATH);
21load_language('help/plugin.lang', LCAS_PATH);
22
23$page['global'] = array();
24$error = array();
25$pattern = '/;/';
26$replacement = '.';
27
28$LCAS_Password_Test_Score = 0;
29$LCAS_Exclusionlist_Error = false;
30
31// +-----------------------------------------------------------------------+
32// |                            Tabssheet                                  |
33// +-----------------------------------------------------------------------+
34if (!isset($_GET['tab']))
35        $page['tab'] = 'global';
36else
37  $page['tab'] = $_GET['tab'];
38
39$tabsheet = new tabsheet();
40$tabsheet->add('global',
41               l10n('LCAS_Tab_Global'),
42               $my_base_url.'&amp;tab=global');
43  $tabsheet->add('userlist',
44                 l10n('LCAS_Tab_UserList'),
45                 $my_base_url.'&amp;tab=userlist');
46$tabsheet->select($page['tab']);
47$tabsheet->assign();
48
49
50// +-----------------------------------------------------------------------+
51// |                      Getting plugin version                           |
52// +-----------------------------------------------------------------------+
53$plugin =  LCAS_PluginInfos(LCAS_PATH);
54$version = $plugin['version'];
55
56
57// +----------------------------------------------------------+
58// |            FCK Editor for email text fields              |
59// +----------------------------------------------------------+
60
61/* Available only for ConfirmMail return page customization */
62$toolbar = 'Basic';
63$width = '750px';
64$height = '300px';
65$areas = array();
66array_push( $areas,'LCAS_accentSensitive_Custom_Txt1','LCAS_accentSensitive_Custom_Txt2');
67
68if (function_exists('set_fckeditor_instance'))
69{
70  $fcke_config = unserialize($conf['FCKEditor']);
71  foreach($areas as $area)
72  {
73    if (!isset($fcke_config[$area]))
74    {
75      $fcke_config[$area] = false;
76    }
77  }
78  $conf['FCKEditor'] = serialize($fcke_config);
79
80  set_fckeditor_instance($areas, $toolbar, $width, $height);
81}
82
83
84// +-----------------------------------------------------------------------+
85// |                            Tabssheet select                           |
86// +-----------------------------------------------------------------------+
87
88switch ($page['tab'])
89{
90// *************************************************************************
91// +-----------------------------------------------------------------------+
92// |                           Global Config                               |
93// +-----------------------------------------------------------------------+
94// *************************************************************************
95  case 'global':
96
97        if (isset($_POST['submit']) and !is_adviser() and isset($_POST['LCAS_Case_Sensitive']) and isset($_POST['LCAS_Accent_Sensitive']) )
98  {
99
100/* General configuration settings */
101
102/* Check if CR-LF exist at begining and end of mail exclusion list - If yes, removes them */
103                $newconf_LCAS= array(
104      $_POST['LCAS_Case_Sensitive'],
105      $_POST['LCAS_Accent_Sensitive']);
106
107    $conf['LoginCaseAccentsSensitivity'] = serialize($newconf_LCAS);
108
109                $query = '
110                UPDATE '.CONFIG_TABLE.'
111                SET value="'.addslashes($conf['LoginCaseAccentsSensitivity']).'"
112                WHERE param="LoginCaseAccentsSensitivity"
113                LIMIT 1
114                ;';
115               
116                pwg_query($query);
117
118                array_push($page['infos'], l10n('LCAS_save_config'));
119  }
120
121
122  $conf_LCAS= unserialize($conf['LoginCaseAccentsSensitivity']);
123
124
125/* Save last opened paragraph in configuration tab */
126  $nb_para=(isset($_POST["nb_para"])) ? $_POST["nb_para"]:"";
127  $nb_para2=(isset($_POST["nb_para2"])) ? $_POST["nb_para2"]:"";
128
129  $template->assign(
130    array(
131    'nb_para'                        => $nb_para,
132    'nb_para2'                       => $nb_para2,
133    'LCAS_VERSION'                   => $version,
134    'LCAS_PATH'                      => LCAS_PATH,
135    'PWG_insensitive_case_logon'     => $conf['insensitive_case_logon']? 'true'              : 'false',
136                'LCAS_Case_Sensitive_TRUE'       => $conf_LCAS[0]=='true'          ? 'checked="checked"' : '' ,
137                'LCAS_Case_Sensitive_FALSE'      => $conf_LCAS[0]=='false'         ? 'checked="checked"' : '' ,
138                'LCAS_Accent_Sensitive_TRUE'     => $conf_LCAS[1]=='true'          ? 'checked="checked"' : '' ,
139                'LCAS_Accent_Sensitive_FALSE'    => $conf_LCAS[1]=='false'         ? 'checked="checked"' : ''
140    )
141  );
142
143
144// +-----------------------------------------------------------------------+
145// |                             errors display                            |
146// +-----------------------------------------------------------------------+
147  if (isset ($errors) and count($errors) != 0)
148  {
149          $template->assign('errors',array());
150          foreach ($errors as $error)
151          {
152                  array_push($page['errors'], $error);
153                }
154        } 
155
156// +-----------------------------------------------------------------------+
157// |                           templates display                           |
158// +-----------------------------------------------------------------------+
159  $template->set_filename('plugin_admin_content', dirname(__FILE__) . '/template/global.tpl');
160  $template->assign_var_from_handle('ADMIN_CONTENT', 'plugin_admin_content');
161
162  break;
163
164
165// *************************************************************************
166// +-----------------------------------------------------------------------+
167// |                           Users list page                             |
168// +-----------------------------------------------------------------------+
169// *************************************************************************
170  case 'userlist':
171 
172  $conf_LCAS= unserialize($conf['LoginCaseAccentsSensitivity']);
173 
174  if ((isset($conf_LCAS[0]) and $conf_LCAS[0]=='true') || (isset($conf_LCAS[1]) and $conf_LCAS[1]=='true'))
175  {
176// +-----------------------------------------------------------------------+
177// |                           initialization                              |
178// +-----------------------------------------------------------------------+
179
180                if (!defined('PHPWG_ROOT_PATH'))
181    {
182        die('Hacking attempt!');
183    }
184         
185    include_once(PHPWG_ROOT_PATH.'admin/include/functions.php');
186
187// +-----------------------------------------------------------------------+
188// | Check Access and exit when user status is not ok                      |
189// +-----------------------------------------------------------------------+
190                check_status(ACCESS_ADMINISTRATOR);
191
192
193// +-----------------------------------------------------------------------+
194// |                               user list                               |
195// +-----------------------------------------------------------------------+
196
197                if ($conf_LCAS[0]=='true' && $conf_LCAS[1]=='true')
198                        $lcas_rule = 2;
199                else if ($conf_LCAS[0]=='true')
200                        $lcas_rule = 1;
201                else if ($conf_LCAS[1]=='true')
202                        $lcas_rule = 3;
203                else
204                        $lcas_rule = 0;
205               
206                $page['all_users'] = LCAS_get_user_list($lcas_rule);
207
208// +-----------------------------------------------------------------------+
209// |                               user list                               |
210// +-----------------------------------------------------------------------+
211
212                $lcas_previous_compare_user = '';
213    $visible_user_list          = array();
214    foreach ($page['all_users'] as $local_user)
215    {
216      if ($lcas_previous_compare_user != $local_user['transformed']) {
217        $display = 'orange';
218        $lcas_previous_compare_user = $local_user['transformed'];
219      }
220      else {
221        $display = '';
222      }
223
224                $template->append(
225                'users',
226        array(
227                'ID'          => $local_user['id'],
228                'USERNAME'    => stripslashes($local_user['username']),
229                'COMPARE'     => stripslashes($local_user['transformed']),
230                                        'EMAIL'       => get_email_address_as_display_text($local_user['email']),
231          'DISPLAY'     => $display,
232                                )
233                        );
234                }
235    /* Plugin version inserted */
236    $template->assign(
237      array(
238        'LCAS_VERSION'  => $version,
239        'LCAS_PATH'     => LCAS_PATH,
240      )
241    );   
242// +-----------------------------------------------------------------------+
243// |                             errors display                            |
244// +-----------------------------------------------------------------------+
245                if ( isset ($errors) and count($errors) != 0)
246                {
247                $template->assign('errors',array());
248                        foreach ($errors as $error)
249                {
250                                array_push($page['errors'], $error);
251                }
252                } 
253
254// +-----------------------------------------------------------------------+
255// |                           templates display                           |
256// +-----------------------------------------------------------------------+
257                $template->set_filename('plugin_admin_content', dirname(__FILE__) . '/template/userlist.tpl');
258    $template->assign_var_from_handle('ADMIN_CONTENT', 'plugin_admin_content');         
259  }
260  else
261  {
262                array_push($page['errors'], l10n('LCAS_Err_Userlist_Settings'));
263  }
264  break;
265
266}
267?>
Note: See TracBrowser for help on using the repository browser.