/**
  * Send password expiration reminders to contacts
  *
  * @access public
  * @return int
  */
 static function sendPasswordExpirationReminders()
 {
     $sent = 0;
     $password_expiration_days = config_option('password_expiration', 0);
     $password_expiration_notification = config_option('password_expiration_notification', 0);
     $contact_passwords = ContactPasswords::getNewestContactPasswords();
     foreach ($contact_passwords as $password) {
         $diff_days = self::getContactPasswordDays($password);
         if ($diff_days == $password_expiration_days - $password_expiration_notification) {
             $contact = Contacts::findById($password->getContactId());
             if ($contact instanceof Contact) {
                 if (Notifier::passwordExpiration($contact, $password_expiration_notification)) {
                     $sent++;
                 }
             }
         }
     }
     return $sent;
 }
 /**
  * Send password expiration reminders to users
  *
  * @access public
  * @return int
  */
 static function sendPasswordExpirationReminders()
 {
     $sent = 0;
     $password_expiration_days = config_option('password_expiration', 0);
     $password_expiration_notification = config_option('password_expiration_notification', 0);
     $user_passwords = UserPasswords::getNewestUserPasswords();
     foreach ($user_passwords as $password) {
         $diff_days = self::getUserPasswordDays($password);
         if ($diff_days == $password_expiration_days - $password_expiration_notification) {
             $user = Users::findById($password->getUserId());
             if ($user instanceof User) {
                 if (Notifier::passwordExpiration($user, $password_expiration_notification)) {
                     $sent++;
                 }
             }
         }
     }
     return $sent;
 }