Show
Ignore:
Timestamp:
03/12/08 20:24:15 (5 years ago)
Author:
d0nut
Message:

finished work on buddyloo 0.9.4

  • privileged users can send board-invitations by mail
  • admin can decide to limit registrations to invited users
  • admin can decide not to show friendship connections
Files:
1 modified

Legend:

Unmodified
Added
Removed
  • buddyloo/files/lib/form/InvitationEditForm.class.php

    r312 r319  
    2020        public $templateName = 'buddylooInvitationEdit'; 
    2121         
     22        protected $flag = false; 
     23         
    2224        /** 
    2325         * @see Page::readParameters() 
     
    3638                        WCF::getTPL()->assign(array( 
    3739                                'success' => 'remove', 
    38                                 'emails' => $_GET['remove'] 
     40                                'changedEmails' => $_GET['remove'] 
    3941                        )); 
    4042                } 
     
    6163                 
    6264                if (count($this->inputArray) == 0) { 
     65                        $this->readInvitations(); 
    6366                        if (empty($this->input)) { 
    6467                                throw new UserInputException('input'); 
    6568                        } 
    66                          
    6769                        $this->validateEmails(); 
    6870                } 
     
    8082                        if (!empty($inserts)) $inserts .= ','; 
    8183                        $inserts .= "(".WCF::getUser()->userID.", '".escapeString($email)."')"; 
     84                        $this->emails[] = $email; 
    8285                } 
    8386                 
     
    8891                        WCF::getDB()->sendQuery($sql); 
    8992                } 
    90  
     93                 
    9194                $this->saved(); 
    92                  
     95 
     96                // show success message 
     97                WCF::getTPL()->assign(array( 
     98                        'success' => 'add', 
     99                        'changedEmails' => $this->input 
     100                )); 
     101 
    93102                // reset input field 
    94103                $this->input = ''; 
    95104                $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; 
    109113                 
    110114                $sql = "SELECT          email 
     
    116120                } 
    117121        } 
     122 
     123        /** 
     124         * @see Page::readData() 
     125         */ 
     126        public function readData() { 
     127                parent::readData(); 
     128                $this->readInvitations(); 
     129        } 
    118130         
    119131        /** 
     
    125137                WCF::getTPL()->assign(array( 
    126138                        'input' => $this->input, 
    127                         'emails' => $this->emails 
     139                        'emails' => $this->emails, 
     140                        'body' => $this->body, 
    128141                )); 
    129142        } 
     
    160173                        if (empty($email)) continue; 
    161174                         
    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)) { 
    163178                                $this->inputArray[] = $email; 
    164179                        } else { 
     
    199214                                '$author' => WCF::getUser()->username, 
    200215                                '$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') : ""), 
    202217                                '$body' => $this->body 
    203218                        ); 
    204219 
    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)); 
    206221                        $mail->send(); 
    207222                }