0) { if (in_array($conf['guest_id'], $collection)) { array_push($page['errors'], l10n('UAM_Guest cannot be pwdreset')); $template->append('errors', l10n('UAM_Guest cannot be pwdreset')); } if (($conf['guest_id'] != $conf['default_user_id']) and in_array($conf['default_user_id'], $collection)) { array_push($page['errors'], l10n('UAM_Default user cannot be pwgreset')); $template->append('errors', l10n('UAM_Default user cannot be pwgreset')); } if (in_array($conf['webmaster_id'], $collection)) { array_push($page['errors'], l10n('UAM_Webmaster cannot be pwdreset')); $template->append('errors', l10n('UAM_Webmaster cannot be pwdreset')); } if (in_array($user['id'], $collection)) { array_push($page['errors'], l10n('UAM_You cannot pwdreset your account')); $template->append('errors', l10n('UAM_You cannot pwdreset your account')); } // Generic accounts exclusion (including Adult_Content generic users) // ------------------------------------------------------------------ $query =' SELECT u.id FROM '.USERS_TABLE.' AS u INNER JOIN '.USER_INFOS_TABLE.' AS ui ON u.id = ui.user_id WHERE ui.status = "generic" ;'; $result = pwg_query($query); while ($row = pwg_db_fetch_assoc($result)) { if (in_array($row['id'], $collection)) { array_push($page['errors'], l10n('UAM_Generic cannot be pwdreset')); $errors = l10n('UAM_Generic cannot be pwdreset'); } } // Admins accounts exclusion // -------------------------- $query =' SELECT u.id FROM '.USERS_TABLE.' AS u INNER JOIN '.USER_INFOS_TABLE.' AS ui ON u.id = ui.user_id WHERE ui.status = "admin" ;'; $result = pwg_query($query); while ($row = pwg_db_fetch_assoc($result)) { if (in_array($row['id'], $collection)) { array_push($page['errors'], l10n('UAM_Admins cannot be pwdreset')); $errors = l10n('UAM_Admins cannot be pwdreset'); } } $template->append('errors', $errors); if (count($page['errors']) == 0) { if (isset($_POST['confirm_pwdreset']) and 1 == $_POST['confirm_pwdreset']) { foreach ($collection as $user_id) { UAM_Set_PwdReset($user_id); } array_push( $page['infos'], l10n_dec( 'UAM %d user pwdreseted', 'UAM %d users pwdreseted', count($collection) ) ); $template->append('infos', l10n_dec( 'UAM %d user pwdreseted', 'UAM %d users pwdreseted', count($collection))); foreach ($page['filtered_users'] as $filter_key => $filter_user) { if (in_array($filter_user['id'], $collection)) { unset($page['filtered_users'][$filter_key]); } } } else { array_push($page['errors'], l10n('UAM_You need to confirm pwdreset')); $template->append('errors', l10n('UAM_You need to confirm pwdreset')); } } } $template->set_prefilter('user_list', 'UAM_PwdReset_Prefilter'); } /** * UAM_PwdReset_Prefilter * Adds action field for password reset in user_list.tpl */ function UAM_PwdReset_Prefilter($content, &$smarty) { $search = '
{\'Deletions\'|@translate}
'; $addon = '
{\'UAM_PwdReset\'|@translate}
'; $replacement = $addon.$search; return str_replace($search, $replacement, $content); } } // Check options compatibility between UAM and Piwigo at admin page load // --------------------------------------------------------------------- add_event_handler('loc_begin_admin_page', 'UAM_check_compat'); ?>