Index: /extensions/NBC_UserAdvManager/trunk/admin/UserAdvManager_admin.php
===================================================================
--- /extensions/NBC_UserAdvManager/trunk/admin/UserAdvManager_admin.php (revision 4134)
+++ /extensions/NBC_UserAdvManager/trunk/admin/UserAdvManager_admin.php (revision 4135)
@@ -36,4 +36,7 @@
l10n('Tab_UserManager'),
$my_base_url.'&tab=usermanager');
+$tabsheet->add('ghosttracker',
+ l10n('Tab_GhostTracker'),
+ $my_base_url.'&tab=ghosttracker');
$tabsheet->select($page['tab']);
$tabsheet->assign();
@@ -56,10 +59,10 @@
case 'global':
- if (isset($_POST['submit']) and !is_adviser() and isset($_POST['UserAdvManager_Mail_Info']) and isset($_POST['UserAdvManager_No_Casse']) and isset($_POST['UserAdvManager_Username_Char']) and isset($_POST['UserAdvManager_Confirm_Mail']) and isset($_POST['UserAdvManager_No_Comment_Anonymous']) and isset($_POST['UserAdvManager_Password_Enforced']) and isset($_POST['UserAdvManager_AdminPassword_Enforced']))
+ if (isset($_POST['submit']) and !is_adviser() and isset($_POST['UserAdvManager_Mail_Info']) and isset($_POST['UserAdvManager_No_Casse']) and isset($_POST['UserAdvManager_Username_Char']) and isset($_POST['UserAdvManager_Confirm_Mail']) and isset($_POST['UserAdvManager_No_Comment_Anonymous']) and isset($_POST['UserAdvManager_Password_Enforced']) and isset($_POST['UserAdvManager_AdminPassword_Enforced']) and isset($_POST['UserAdvManager_GhostUser_Tracker']))
{
$_POST['UserAdvManager_MailInfo_Text'] = str_replace("\'", "'", str_replace("\\\\", "\\", $_POST['UserAdvManager_MailInfo_Text']));
$_POST['UserAdvManager_ConfirmMail_Text'] = str_replace("\'", "'", str_replace("\\\\", "\\", $_POST['UserAdvManager_ConfirmMail_Text']));
- $newconf_nbc_UserAdvManager = $_POST['UserAdvManager_Mail_Info'].';'.$_POST['UserAdvManager_No_Casse'].';'.$_POST['UserAdvManager_Confirm_Mail'].';'.(isset($_POST['UserAdvManager_No_Confirm_Group'])?$_POST['UserAdvManager_No_Confirm_Group']:'').';'.(isset($_POST['UserAdvManager_Validated_Group'])?$_POST['UserAdvManager_Validated_Group']:'').';'.(isset($_POST['UserAdvManager_Validated_Status'])?$_POST['UserAdvManager_Validated_Status']:'').';'.$_POST['UserAdvManager_No_Comment_Anonymous'].';'.$_POST['UserAdvManager_Username_Char'].';'.$_POST['UserAdvManager_Username_List'].';'.(isset($_POST['UserAdvManager_No_Confirm_Status'])?$_POST['UserAdvManager_No_Confirm_Status']:'').';'.$_POST['UserAdvManager_MailInfo_Text'].';'.$_POST['UserAdvManager_ConfirmMail_Text'].';'.$_POST['UserAdvManager_MailExclusion'].';'.$_POST['UserAdvManager_MailExclusion_List'].';'.$_POST['UserAdvManager_Password_Enforced'].';'.$_POST['UserAdvManager_Password_Score'].';'.$_POST['UserAdvManager_AdminPassword_Enforced'];
+ $newconf_nbc_UserAdvManager = $_POST['UserAdvManager_Mail_Info'].';'.$_POST['UserAdvManager_No_Casse'].';'.$_POST['UserAdvManager_Confirm_Mail'].';'.(isset($_POST['UserAdvManager_No_Confirm_Group'])?$_POST['UserAdvManager_No_Confirm_Group']:'').';'.(isset($_POST['UserAdvManager_Validated_Group'])?$_POST['UserAdvManager_Validated_Group']:'').';'.(isset($_POST['UserAdvManager_Validated_Status'])?$_POST['UserAdvManager_Validated_Status']:'').';'.$_POST['UserAdvManager_No_Comment_Anonymous'].';'.$_POST['UserAdvManager_Username_Char'].';'.$_POST['UserAdvManager_Username_List'].';'.(isset($_POST['UserAdvManager_No_Confirm_Status'])?$_POST['UserAdvManager_No_Confirm_Status']:'').';'.$_POST['UserAdvManager_MailInfo_Text'].';'.$_POST['UserAdvManager_ConfirmMail_Text'].';'.$_POST['UserAdvManager_MailExclusion'].';'.$_POST['UserAdvManager_MailExclusion_List'].';'.$_POST['UserAdvManager_Password_Enforced'].';'.$_POST['UserAdvManager_Password_Score'].';'.$_POST['UserAdvManager_AdminPassword_Enforced'].';'.$_POST['UserAdvManager_GhostUser_Tracker'];
$conf['nbc_UserAdvManager'] = $newconf_nbc_UserAdvManager;
@@ -204,4 +207,6 @@
'UserAdvManager_ADMINPASSWENF_TRUE' => $conf_nbc_UserAdvManager[16]=='true' ? 'checked="checked"' : '' ,
'UserAdvManager_ADMINPASSWENF_FALSE' => $conf_nbc_UserAdvManager[16]=='false' ? 'checked="checked"' : '' ,
+ 'UserAdvManager_GHOSTRACKER_TRUE' => $conf_nbc_UserAdvManager[17]=='true' ? 'checked="checked"' : '' ,
+ 'UserAdvManager_GHOSTRACKER_FALSE' => $conf_nbc_UserAdvManager[17]=='false' ? 'checked="checked"' : '' ,
'UserAdvManager_PASSWORD_TEST_SCORE' => $UserAdvManager_Password_Test_Score,
)
@@ -913,4 +918,528 @@
array_push($page['infos'], l10n('Err_UserManager_Settings'));
}
+ break;
+
+
+// *************************************************************************
+// +-----------------------------------------------------------------------+
+// | Ghost Tracker page |
+// +-----------------------------------------------------------------------+
+// *************************************************************************
+ case 'ghosttracker':
+ $conf_nbc_UserAdvManager = isset($conf['nbc_UserAdvManager']) ? explode(";" , $conf['nbc_UserAdvManager']) : array();
+
+ if (isset($conf_nbc_UserAdvManager[17]) and $conf_nbc_UserAdvManager[17]=='true')
+ {
+// +-----------------------------------------------------------------------+
+// | initialization |
+// +-----------------------------------------------------------------------+
+
+ if (!defined('PHPWG_ROOT_PATH'))
+ {
+ die('Hacking attempt!');
+ }
+
+ include_once(PHPWG_ROOT_PATH.'admin/include/functions.php');
+
+// +-----------------------------------------------------------------------+
+// | Check Access and exit when user status is not ok |
+// +-----------------------------------------------------------------------+
+ check_status(ACCESS_ADMINISTRATOR);
+
+ $page['order_by_items'] = array(
+ 'id' => l10n('registration_date'),
+ 'username' => l10n('Username'),
+ 'level' => l10n('Privacy level'),
+ 'language' => l10n('language'),
+ );
+
+// +-----------------------------------------------------------------------+
+// | user list |
+// +-----------------------------------------------------------------------+
+
+ $page['filtered_users'] = get_unvalid_user_list();
+
+// +-----------------------------------------------------------------------+
+// | selected users |
+// +-----------------------------------------------------------------------+
+ if (isset($_POST['Del_Selected']))
+ {
+ $collection = array();
+
+ switch ($_POST['target'])
+ {
+ case 'all' :
+ {
+ foreach($page['filtered_users'] as $local_user)
+ {
+ array_push($collection, $local_user['id']);
+ }
+ break;
+ }
+ case 'selection' :
+ {
+ if (isset($_POST['selection']))
+ {
+ $collection = $_POST['selection'];
+ }
+ break;
+ }
+ }
+
+ if (count($collection) == 0)
+ {
+ array_push($page['errors'], l10n('Select at least one user'));
+ }
+ }
+
+// +-----------------------------------------------------------------------+
+// | delete users |
+// +-----------------------------------------------------------------------+
+ if (isset($_POST['Del_Selected']) and count($collection) > 0)
+ {
+ if (in_array($conf['guest_id'], $collection))
+ {
+ array_push($page['errors'], l10n('Guest cannot be deleted'));
+ }
+ if (($conf['guest_id'] != $conf['default_user_id']) and
+ in_array($conf['default_user_id'], $collection))
+ {
+ array_push($page['errors'], l10n('Default user cannot be deleted'));
+ }
+ if (in_array($conf['webmaster_id'], $collection))
+ {
+ array_push($page['errors'], l10n('Webmaster cannot be deleted'));
+ }
+ if (in_array($user['id'], $collection))
+ {
+ array_push($page['errors'], l10n('You cannot delete your account'));
+ }
+
+ if (count($page['errors']) == 0)
+ {
+ foreach ($collection as $user_id)
+ {
+ delete_user($user_id);
+ }
+ array_push(
+ $page['infos'],
+ l10n_dec(
+ '%d user deleted', '%d users deleted',
+ count($collection)
+ )
+ );
+
+ foreach ($page['filtered_users'] as $filter_key => $filter_user)
+ {
+ if (in_array($filter_user['id'], $collection))
+ {
+ unset($page['filtered_users'][$filter_key]);
+ }
+ }
+ }
+ }
+
+// +-----------------------------------------------------------------------+
+// | Resend new validation key to users |
+// +-----------------------------------------------------------------------+
+// +-----------------------------------------------------------------------+
+// | selected users |
+// +-----------------------------------------------------------------------+
+ if (isset($_POST['Mail_With_Key']))
+ {
+ $collection = array();
+
+ switch ($_POST['target'])
+ {
+ case 'all' :
+ {
+ foreach($page['filtered_users'] as $local_user)
+ {
+ array_push($collection, $local_user['id']);
+ }
+ break;
+ }
+ case 'selection' :
+ {
+ if (isset($_POST['selection']))
+ {
+ $collection = $_POST['selection'];
+ }
+ break;
+ }
+ }
+
+ if (count($collection) == 0)
+ {
+ array_push($page['errors'], l10n('Select at least one user'));
+ }
+ }
+// +-----------------------------------------------------------------------+
+// | Resend new validation key to users |
+// +-----------------------------------------------------------------------+
+ if (isset($_POST['Mail_With_Key']) and count($collection) > 0)
+ {
+ if (in_array($conf['guest_id'], $collection))
+ {
+ array_push($page['errors'], l10n('No_validation_for_Guest'));
+ }
+ if (($conf['guest_id'] != $conf['default_user_id']) and
+ in_array($conf['default_user_id'], $collection))
+ {
+ array_push($page['errors'], l10n('No_validation_for_default_user'));
+ }
+ if (in_array($conf['webmaster_id'], $collection))
+ {
+ array_push($page['errors'], l10n('No_validation_for_Webmaster'));
+ }
+ if (in_array($user['id'], $collection))
+ {
+ array_push($page['errors'], l10n('No_validation_for_your_account'));
+ }
+
+ if (count($page['errors']) == 0)
+ {
+ foreach ($collection as $user_id)
+ {
+ $typemail = 1;
+ $query = "
+ SELECT id, username, mail_address
+ FROM ".USERS_TABLE."
+ WHERE id = '".$user_id."'
+ ;";
+ $data = mysql_fetch_array(pwg_query($query));
+
+ ResendMail2User($typemail,$user_id,$data['username'],$data['mail_address'],true);
+ }
+ array_push(
+ $page['infos'],
+ l10n_dec(
+ '%d_Mail_With_Key', '%d_Mails_With_Key',
+ count($collection)
+ )
+ );
+
+ $page['filtered_users'] = get_unvalid_user_list();
+ }
+ }
+
+// +-----------------------------------------------------------------------+
+// | Send reminder without new key to users |
+// +-----------------------------------------------------------------------+
+// +-----------------------------------------------------------------------+
+// | selected users |
+// +-----------------------------------------------------------------------+
+ if (isset($_POST['Mail_Without_Key']))
+ {
+ $collection = array();
+
+ switch ($_POST['target'])
+ {
+ case 'all' :
+ {
+ foreach($page['filtered_users'] as $local_user)
+ {
+ array_push($collection, $local_user['id']);
+ }
+ break;
+ }
+ case 'selection' :
+ {
+ if (isset($_POST['selection']))
+ {
+ $collection = $_POST['selection'];
+ }
+ break;
+ }
+ }
+
+ if (count($collection) == 0)
+ {
+ array_push($page['errors'], l10n('Select at least one user'));
+ }
+ }
+// +-----------------------------------------------------------------------+
+// | Send reminder without new key to users |
+// +-----------------------------------------------------------------------+
+ if (isset($_POST['Mail_Without_Key']) and count($collection) > 0)
+ {
+ if (in_array($conf['guest_id'], $collection))
+ {
+ array_push($page['errors'], l10n('No_validation_for_Guest'));
+ }
+ if (($conf['guest_id'] != $conf['default_user_id']) and
+ in_array($conf['default_user_id'], $collection))
+ {
+ array_push($page['errors'], l10n('No_validation_for_default_user'));
+ }
+ if (in_array($conf['webmaster_id'], $collection))
+ {
+ array_push($page['errors'], l10n('No_validation_for_Webmaster'));
+ }
+ if (in_array($user['id'], $collection))
+ {
+ array_push($page['errors'], l10n('No_validation_for_your_account'));
+ }
+
+ if (count($page['errors']) == 0)
+ {
+ foreach ($collection as $user_id)
+ {
+ $typemail = 2;
+ $query = "
+ SELECT id, username, mail_address
+ FROM ".USERS_TABLE."
+ WHERE id = '".$user_id."'
+ ;";
+
+ $data = mysql_fetch_array(pwg_query($query));
+
+ ResendMail2User($typemail,$user_id,$data['username'],$data['mail_address'],false);
+ }
+ array_push(
+ $page['infos'],
+ l10n_dec(
+ '%d_Reminder_Sent', '%d_Reminders_Sent',
+ count($collection)
+ )
+ );
+
+ $page['filtered_users'] = get_unvalid_user_list();
+ }
+ }
+
+// +-----------------------------------------------------------------------+
+// | Force validation |
+// +-----------------------------------------------------------------------+
+// +-----------------------------------------------------------------------+
+// | selected users |
+// +-----------------------------------------------------------------------+
+ if (isset($_POST['Force_Validation']))
+ {
+ $collection = array();
+
+ switch ($_POST['target'])
+ {
+ case 'all' :
+ {
+ foreach($page['filtered_users'] as $local_user)
+ {
+ array_push($collection, $local_user['id']);
+ }
+ break;
+ }
+ case 'selection' :
+ {
+ if (isset($_POST['selection']))
+ {
+ $collection = $_POST['selection'];
+ }
+ break;
+ }
+ }
+
+ if (count($collection) == 0)
+ {
+ array_push($page['errors'], l10n('Select at least one user'));
+ }
+ }
+// +-----------------------------------------------------------------------+
+// | Force validation |
+// +-----------------------------------------------------------------------+
+ if (isset($_POST['Force_Validation']) and count($collection) > 0)
+ {
+ if (in_array($conf['guest_id'], $collection))
+ {
+ array_push($page['errors'], l10n('No_validation_for_Guest'));
+ }
+ if (($conf['guest_id'] != $conf['default_user_id']) and
+ in_array($conf['default_user_id'], $collection))
+ {
+ array_push($page['errors'], l10n('No_validation_for_default_user'));
+ }
+ if (in_array($conf['webmaster_id'], $collection))
+ {
+ array_push($page['errors'], l10n('No_validation_for_Webmaster'));
+ }
+ if (in_array($user['id'], $collection))
+ {
+ array_push($page['errors'], l10n('No_validation_for_your_account'));
+ }
+
+ if (count($page['errors']) == 0)
+ {
+ foreach ($collection as $user_id)
+ {
+ $query = "
+ SELECT id, username, mail_address
+ FROM ".USERS_TABLE."
+ WHERE id = '".$user_id."'
+ ;";
+
+ $data = mysql_fetch_array(pwg_query($query));
+
+ ForceValidation($data['id']);
+ }
+ array_push(
+ $page['infos'],
+ l10n_dec(
+ '%d_Validated_User', '%d_Validated_Users',
+ count($collection)
+ )
+ );
+
+ $page['filtered_users'] = get_unvalid_user_list();
+ }
+ }
+
+
+// +-----------------------------------------------------------------------+
+// | groups list |
+// +-----------------------------------------------------------------------+
+
+ $groups[-1] = '------------';
+
+ $query = '
+ SELECT id, name
+ FROM '.GROUPS_TABLE.'
+ ORDER BY name ASC
+ ;';
+
+ $result = pwg_query($query);
+
+ while ($row = mysql_fetch_array($result))
+ {
+ $groups[$row['id']] = $row['name'];
+ }
+
+// +-----------------------------------------------------------------------+
+// | Template Init |
+// +-----------------------------------------------------------------------+
+ $base_url = PHPWG_ROOT_PATH.'admin.php?page=user_list';
+
+ if (isset($_GET['start']) and is_numeric($_GET['start']))
+ {
+ $start = $_GET['start'];
+ }
+ else
+ {
+ $start = 0;
+ }
+
+ $template->assign(
+ array(
+ 'F_ADD_ACTION' => $base_url,
+ 'F_USERNAME' => @htmlentities($_GET['username']),
+ 'F_FILTER_ACTION' => get_root_url().'admin.php'
+ )
+ );
+
+/* Hide radio-button if not allow to assign adviser */
+ if ($conf['allow_adviser'])
+ {
+ $template->assign('adviser', true);
+ }
+
+// +-----------------------------------------------------------------------+
+// | user list |
+// +-----------------------------------------------------------------------+
+
+ $profile_url = get_root_url().'admin.php?page=profile&user_id=';
+ $perm_url = get_root_url().'admin.php?page=user_perm&user_id=';
+
+ $visible_user_list = array();
+ foreach ($page['filtered_users'] as $num => $local_user)
+ {
+/* simulate LIMIT $start, $conf['users_page'] */
+ if ($num < $start)
+ {
+ continue;
+ }
+ if ($num >= $start + $conf['users_page'])
+ {
+ break;
+ }
+
+ $visible_user_list[] = $local_user;
+ }
+
+ foreach ($visible_user_list as $local_user)
+ {
+ $groups_string = preg_replace(
+ '/(\d+)/e',
+ "\$groups['$1']",
+ implode(
+ ', ',
+ $local_user['groups']
+ )
+ );
+
+ if (isset($_POST['pref_submit'])
+ and isset($_POST['selection'])
+ and in_array($local_user['id'], $_POST['selection']))
+ {
+ $checked = 'checked="checked"';
+ }
+ else
+ {
+ $checked = '';
+ }
+
+ $properties = array();
+ if ( $local_user['level'] != 0 )
+ {
+ $properties[] = l10n( sprintf('Level %d', $local_user['level']) );
+ }
+ $properties[] =
+ (isset($local_user['enabled_high']) and ($local_user['enabled_high'] == 'true'))
+ ? l10n('is_high_enabled') : l10n('is_high_disabled');
+
+ $expiration = expiration($local_user['id']);
+
+ $template->append(
+ 'users',
+ array(
+ 'ID' => $local_user['id'],
+ 'CHECKED' => $checked,
+ 'U_PROFILE' => $profile_url.$local_user['id'],
+ 'U_PERM' => $perm_url.$local_user['id'],
+ 'USERNAME' => $local_user['username']
+ .($local_user['id'] == $conf['guest_id']
+ ? '
['.l10n('is_the_guest').']' : '')
+ .($local_user['id'] == $conf['default_user_id']
+ ? '
['.l10n('is_the_default').']' : ''),
+ 'STATUS' => l10n('user_status_'.
+ $local_user['status']).(($local_user['adviser'] == 'true')
+ ? '
['.l10n('adviser').']' : ''),
+ 'EMAIL' => get_email_address_as_display_text($local_user['email']),
+ 'GROUPS' => $groups_string,
+ 'REGISTRATION' => $local_user['registration_date'],
+ 'EXPIRATION' => $expiration,
+ )
+ );
+ }
+
+// +-----------------------------------------------------------------------+
+// | errors display |
+// +-----------------------------------------------------------------------+
+ if ( isset ($errors) and count($errors) != 0)
+ {
+ $template->assign('errors',array());
+ foreach ($errors as $error)
+ {
+ array_push($page['errors'], $error);
+ }
+ }
+
+// +-----------------------------------------------------------------------+
+// | templates display |
+// +-----------------------------------------------------------------------+
+ $template->set_filename('plugin_admin_content', dirname(__FILE__) . '/ghosttracker.tpl');
+ $template->assign_var_from_handle('ADMIN_CONTENT', 'plugin_admin_content');
+ }
+ else
+ {
+ array_push($page['infos'], l10n('Err_GhostTracker_Settings'));
+ }
break;
}
Index: /extensions/NBC_UserAdvManager/trunk/admin/global.tpl
===================================================================
--- /extensions/NBC_UserAdvManager/trunk/admin/global.tpl (revision 4134)
+++ /extensions/NBC_UserAdvManager/trunk/admin/global.tpl (revision 4135)
@@ -47,4 +47,10 @@
+
+