コード例 #1
0
 /**
  * Output the object.
  *
  * @param smdoc $foowd Reference to the foowd environment object.
  */
 function method_view()
 {
     $this->foowd->track('smdoc_user->method_view');
     if ($this->foowd->user->inGroup('Author', $this->creatorid)) {
         $this->foowd->template->assign('SM_version', $this->smver_to_string());
         $this->foowd->template->assign('IMAP_server', $this->imap_to_string());
         $this->foowd->template->assign('SMTP_server', $this->smtp_to_string());
     }
     $this->foowd->template->assign('show_email', $this->show_email);
     $nicks = $this->IM_nicks;
     if ($this->IRC != '') {
         $nicks['IRC'] = $this->IRC;
     }
     if (!empty($nicks)) {
         $this->foowd->template->assign('nicks', $nicks);
     }
     parent::method_view();
     $this->foowd->track();
 }
コード例 #2
0
ファイル: class.user.php プロジェクト: teammember8/roundcube
 /**
  * Get user a new password if it has been lost.
  *
  * @access private
  * @static
  * @param smdoc $foowd Reference to the foowd environment object.
  * @param string username The name of the user to fetch the password for.
  * @param string queryUsername Username given for stage 2 of the retrieval process.
  * @param string id The ID given for stage 2 of the process.
  * @return int 0 = nothing, display form<br />
  *             1 = password change request e-mail sent<br />
  *             2 = could not send e-mail due to technical problem<br />
  *             3 = user has no e-mail address<br />
  *             4 = user does not exist<br />
  *             5 = password changed and e-mail sent<br />
  *             6 = could not send e-mail due to technical problem<br />
  *             7 = id does not match<br />
  *             8 = user does not exist<br />
  */
 function fetchPassword(&$foowd, $username, $queryUsername = NULL, $id = NULL)
 {
     if ($username == '') {
         return 0;
     }
     // nothing, display form
     $user_info['username'] = $username;
     $lostuser =& base_user::fetchUser($foowd, $user_info);
     if (!$lostuser || !isset($lostuser->title) || strtolower($lostuser->title) != strtolower($username)) {
         return 4;
     }
     // user does not exist
     if (!isset($lostuser->email)) {
         return 3;
     }
     // user has no e-mail address
     $site = $foowd->config_settings['site']['site_name'];
     // We have username only, send stage one email
     if ($id == NULL && $queryUsername == NULL) {
         $foowd->template->assign('sitename', $site);
         $foowd->template->assign('username', $lostuser->title);
         $foowd->template->assign('hostname', $_SERVER['SERVER_NAME']);
         $foowd->template->assign('class', 'base_user');
         $foowd->template->assign('id', md5($user->updated . $user->title));
         $message = $foowd->template->fetch('fetchpwd_request.tpl');
         $result = email($foowd, $lostuser->email, sprintf(_("%s - Password Change Request"), $site), $message, 'From: ' . $foowd->config_settings['site']['email_webmaster'] . '\\r\\nReply-To: ' . $foowd->config_settings['site']['email_noreply']);
         if ($result) {
             return 1;
         } else {
             return 2;
         }
         // could not send e-mail due to technical problem
     } else {
         if (strtolower($lostuser->title) != strtolower($queryUsername)) {
             return 8;
         }
         // user does not exist
         if ($id != md5($lostuser->updated . $lostuser->title)) {
             return 7;
         }
         // id does not match
         $newPassword = '';
         $foo_len = rand(6, 12);
         srand(time());
         for ($foo = 0; $foo < $foo_len; $foo++) {
             $newPassword .= chr(rand(97, 122));
         }
         $lostuser->set('password', md5($salt . $newPassword));
         $salt = $this->foowd->config_settings['user']['password_salt'];
         $foowd->template->assign('sitename', $site);
         $foowd->template->assign('username', $user->title);
         $foowd->template->assign('password', $newPassword);
         $foowd->template->assign('hostname', $_SERVER['SERVER_NAME']);
         $foowd->template->assign('class', 'base_user');
         $message = $foowd->template->fetch('fetchpwd_response.tpl');
         $result = email($foowd, $lostuser->email, sprintf(_("%s - Password Change Request"), $site), $message, 'From: ' . $foowd->config_settings['site']['email_webmaster'] . '\\r\\nReply-To: ' . $foowd->config_settings['site']['email_noreply']);
         if ($result) {
             return 5;
         } else {
             return 6;
         }
         // could not send e-mail due to technical problem (or could not save new password)
     }
     return 0;
     // nothing, display form
 }