Changeset 319 for buddyloo/files/lib/form/InvitationEditForm.class.php
- Timestamp:
- 03/12/08 20:24:15 (5 years ago)
- Files:
-
- 1 modified
Legend:
- Unmodified
- Added
- Removed
-
buddyloo/files/lib/form/InvitationEditForm.class.php
r312 r319 20 20 public $templateName = 'buddylooInvitationEdit'; 21 21 22 protected $flag = false; 23 22 24 /** 23 25 * @see Page::readParameters() … … 36 38 WCF::getTPL()->assign(array( 37 39 'success' => 'remove', 38 ' emails' => $_GET['remove']40 'changedEmails' => $_GET['remove'] 39 41 )); 40 42 } … … 61 63 62 64 if (count($this->inputArray) == 0) { 65 $this->readInvitations(); 63 66 if (empty($this->input)) { 64 67 throw new UserInputException('input'); 65 68 } 66 67 69 $this->validateEmails(); 68 70 } … … 80 82 if (!empty($inserts)) $inserts .= ','; 81 83 $inserts .= "(".WCF::getUser()->userID.", '".escapeString($email)."')"; 84 $this->emails[] = $email; 82 85 } 83 86 … … 88 91 WCF::getDB()->sendQuery($sql); 89 92 } 90 93 91 94 $this->saved(); 92 95 96 // show success message 97 WCF::getTPL()->assign(array( 98 'success' => 'add', 99 'changedEmails' => $this->input 100 )); 101 93 102 // reset input field 94 103 $this->input = ''; 95 104 $this->body = ''; 96 97 // show success message 98 WCF::getTPL()->assign(array( 99 'success' => 'add', 100 'emails' => $this->emails 101 )); 102 } 103 104 /** 105 * @see Page::readData() 106 */ 107 public function readData() { 108 parent::readData(); 105 } 106 107 /** 108 * 109 */ 110 protected function readInvitations() { 111 if($this->flag) return; 112 $this->flag = true; 109 113 110 114 $sql = "SELECT email … … 116 120 } 117 121 } 122 123 /** 124 * @see Page::readData() 125 */ 126 public function readData() { 127 parent::readData(); 128 $this->readInvitations(); 129 } 118 130 119 131 /** … … 125 137 WCF::getTPL()->assign(array( 126 138 'input' => $this->input, 127 'emails' => $this->emails 139 'emails' => $this->emails, 140 'body' => $this->body, 128 141 )); 129 142 } … … 160 173 if (empty($email)) continue; 161 174 162 if (UserRegistrationUtil::isValidEmail($email)) { 175 if(in_array($email, $this->emails)) { 176 $error[] = array('type' => 'duplicate', 'email' => $email); 177 } else if (UserRegistrationUtil::isValidEmail($email)) { 163 178 $this->inputArray[] = $email; 164 179 } else { … … 199 214 '$author' => WCF::getUser()->username, 200 215 '$pageurl' => FileUtil::addTrailingSlash(PAGE_URL), 201 '$notice' => (REGISTER_INVITATIONS ? WCF ->getLanguage()->get('wcf.buddyloo.invitation.register_invitation') : ""),216 '$notice' => (REGISTER_INVITATIONS ? WCF::getLanguage()->get('wcf.buddyloo.invitation.register_invitation') : ""), 202 217 '$body' => $this->body 203 218 ); 204 219 205 $mail = new Mail(array($recipient->email), WCF ->getLanguage()->get('wcf.buddyloo.invitation.subject', $subjectData), WCF->getLanguage()->get('wcf.buddyloo.invitation.body', $messageData));220 $mail = new Mail(array($recipient->email), WCF::getLanguage()->get('wcf.buddyloo.invitation.mail.subject', $subjectData), WCF::getLanguage()->get('wcf.buddyloo.invitation.mail.body', $messageData)); 206 221 $mail->send(); 207 222 }
