Exemplo n.º 1
0
} elseif ($getMode === 4) {
    // nur Webmaster duerfen User neue Zugangsdaten zuschicken
    // nur ausfuehren, wenn E-Mails vom Server unterstuetzt werden
    // nur an Mitglieder der eigenen Organisation schicken
    if (!$gCurrentUser->isWebmaster() || $gPreferences['enable_system_mails'] != 1 || $this_orga == false) {
        $gMessage->show($gL10n->get('SYS_NO_RIGHTS'));
    }
    if ($gPreferences['enable_system_mails'] == 1) {
        try {
            // neues Passwort generieren und abspeichern
            $password = PasswordHashing::genRandomPassword(8);
            $user->setPassword($password);
            $user->save();
            // Mail an den User mit den Loginaten schicken
            $sysmail = new SystemMail($gDb);
            $sysmail->addRecipient($user->getValue('EMAIL'), $user->getValue('FIRST_NAME') . ' ' . $user->getValue('LAST_NAME'));
            $sysmail->setVariable(1, $password);
            $sysmail->sendSystemMail('SYSMAIL_NEW_PASSWORD', $user);
            $gMessage->setForwardUrl($gNavigation->getUrl());
            $gMessage->show($gL10n->get('SYS_EMAIL_SEND'));
        } catch (AdmException $e) {
            $e->showText();
        }
    }
} elseif ($getMode === 5) {
    // Fragen, ob Zugangsdaten verschickt werden sollen
    $gMessage->setForwardYesNo($g_root_path . '/adm_program/modules/members/members_function.php?usr_id=' . $getUserId . '&mode=4');
    $gMessage->show($gL10n->get('MEM_SEND_NEW_LOGIN', $user->getValue('FIRST_NAME') . ' ' . $user->getValue('LAST_NAME')));
} elseif ($getMode === 6) {
    if ($this_orga == true && $other_orga == 0 && $gCurrentUser->isWebmaster()) {
        // nur Webmaster duerfen dies
Exemplo n.º 2
0
 /**
  * Save all changed columns of the recordset in table of database. If it's a new user
  * than the registration table will also be filled with a new recordset and optional a
  * notification mail will be send to all users of roles that have the right to confirm registrations
  * @param bool $updateFingerPrint Default @b true. Will update the creator or editor of the recordset
  *                                if table has columns like @b usr_id_create or @b usr_id_changed
  */
 public function save($updateFingerPrint = true)
 {
     global $gMessage, $gL10n, $gPreferences;
     // if new registration is saved then set user not valid
     if ($this->TableRegistration->isNewRecord()) {
         $this->setValue('usr_valid', 0);
     }
     parent::save($updateFingerPrint);
     // if new registration is saved then save also record in registration table and send notification mail
     if ($this->TableRegistration->isNewRecord()) {
         // save registration record
         $this->TableRegistration->setValue('reg_org_id', $this->organizationId);
         $this->TableRegistration->setValue('reg_usr_id', $this->getValue('usr_id'));
         $this->TableRegistration->setValue('reg_timestamp', DATETIME_NOW);
         $this->TableRegistration->save();
         // send a notification mail to all role members of roles that can approve registrations
         // therefore the flags system mails and notification mail for roles with approve registration must be activated
         if ($gPreferences['enable_system_mails'] == 1 && $gPreferences['enable_registration_admin_mail'] == 1 && $this->sendEmail) {
             $sql = 'SELECT DISTINCT first_name.usd_value as first_name, last_name.usd_value as last_name, email.usd_value as email
                       FROM ' . TBL_ROLES . ', ' . TBL_CATEGORIES . ', ' . TBL_MEMBERS . ', ' . TBL_USERS . '
                      RIGHT JOIN ' . TBL_USER_DATA . ' email
                         ON email.usd_usr_id = usr_id
                        AND email.usd_usf_id = ' . $this->mProfileFieldsData->getProperty('EMAIL', 'usf_id') . '
                        AND LENGTH(email.usd_value) > 0
                       LEFT JOIN ' . TBL_USER_DATA . ' first_name
                         ON first_name.usd_usr_id = usr_id
                        AND first_name.usd_usf_id = ' . $this->mProfileFieldsData->getProperty('FIRST_NAME', 'usf_id') . '
                       LEFT JOIN ' . TBL_USER_DATA . ' last_name
                         ON last_name.usd_usr_id = usr_id
                        AND last_name.usd_usf_id = ' . $this->mProfileFieldsData->getProperty('LAST_NAME', 'usf_id') . '
                      WHERE rol_approve_users = 1
                        AND rol_cat_id        = cat_id
                        AND cat_org_id        = ' . $this->organizationId . '
                        AND mem_rol_id        = rol_id
                        AND mem_begin        <= \'' . DATE_NOW . '\'
                        AND mem_end           > \'' . DATE_NOW . '\'
                        AND mem_usr_id        = usr_id
                        AND usr_valid         = 1 ';
             $result = $this->db->query($sql);
             while ($row = $this->db->fetch_array($result)) {
                 // send mail that a new registration is available
                 $sysmail = new SystemMail($this->db);
                 $sysmail->addRecipient($row['email'], $row['first_name'] . ' ' . $row['last_name']);
                 $sysmail->sendSystemMail('SYSMAIL_REGISTRATION_WEBMASTER', $this);
             }
         }
     }
 }