Пример #1
0
 public function Active($pAddress, $pUserId)
 {
     $UserAccounts = new cModel('UserAccounts');
     $UserAccounts->Structure();
     $UserAccounts->Retrieve(array('Email' => $pAddress));
     if ($UserAccounts->Get('Total') == 0) {
         return false;
     }
     return true;
 }
Пример #2
0
 public function Load($pUser)
 {
     $UserAccounts = new cModel("UserAccounts");
     $UserAccounts->Structure();
     if (is_int($pUser)) {
         $UserAccounts->Retrieve(array('Account_PK' => $pUser));
     } else {
         $UserAccounts->Retrieve(array('Username' => $pUser));
     }
     $UserAccounts->Fetch();
     if (!$UserAccounts->Get("Username")) {
         return false;
     }
     $this->Username = $UserAccounts->Get("Username");
     $this->Id = $UserAccounts->Get("Account_PK");
     // Load the user profile information.
     $UserProfile = new cModel("UserProfile");
     $UserProfile->Retrieve(array("Account_FK" => $UserAccounts->Get("Account_PK")));
     $UserProfile->Fetch();
     $this->Account_PK = $UserProfile->Get("Account_FK");
     if ($UserProfile->Get("Alias")) {
         $this->Fullname = $UserProfile->Get("Alias");
     } else {
         $this->Fullname = $UserProfile->Get("Fullname");
     }
     $this->Description = $UserProfile->Get("Description");
     $this->Domain = $_SERVER['HTTP_HOST'];
     $this->Account = $this->Username . '@' . $this->Domain;
     $this->Email = $UserAccounts->Get('Email');
     $this->Remote = false;
     return true;
 }
Пример #3
0
 function _EmailAccepted($pSenderId, $pRecipientId)
 {
     // @todo Move retrieval of local user info into Talk function
     $UserAccounts = new cModel('UserAccounts');
     $UserAccounts->Structure();
     $UserAccounts->Retrieve(array('Account_PK' => $pSenderId));
     $UserAccounts->Fetch();
     $Sender = $UserAccounts->Get('Username') . '@' . ASD_DOMAIN;
     $UserAccounts->Retrieve(array('Account_PK' => $pRecipientId));
     $UserAccounts->Fetch();
     $Recipient = $UserAccounts->Get('Username') . '@' . ASD_DOMAIN;
     $UserProfile = new cModel('UserProfile');
     $UserProfile->Structure();
     $UserProfile->Retrieve(array('Account_FK' => $pRecipientId));
     $UserProfile->Fetch();
     $Email = $UserAccounts->Get('Email');
     $Recipient = $UserAccounts->Get('Username') . '@' . ASD_DOMAIN;
     $data = array('request' => $Sender, 'source' => ASD_DOMAIN, 'account' => $Recipient);
     $SenderInfo = $this->GetSys('Event')->Trigger('On', 'User', 'Info', $data);
     $SenderFullname = $SenderInfo->fullname;
     $SenderNameParts = explode(' ', $SenderInfo->fullname);
     $SenderFirstName = $SenderNameParts[0];
     list($RecipientUsername, $RecipientDomain) = explode('@', $Recipient);
     $MailSubject = __('Someone Accepted An Invite', array('fullname' => $SenderFullname));
     $Byline = __('Accepted An Invite');
     $Subject = __('Accepted An Invite Subject', array('firstname' => $SenderFirstName));
     $LinkDescription = __('Click Here For Friends');
     $Link = 'http://' . ASD_DOMAIN . '/profile/' . $RecipientUsername . '/friends/';
     $Body = __('Accepted An Invite Description', array('fullname' => $SenderFullname, 'domain' => 'http://' . ASD_DOMAIN, 'link' => $Link));
     $Message = array('Type' => 'User', 'SenderFullname' => $SenderFullname, 'SenderAccount' => $Sender, 'RecipientEmail' => $Email, 'MailSubject' => $MailSubject, 'Byline' => $Byline, 'Subject' => $Subject, 'Body' => $Body, 'LinkDescription' => $LinkDescription, 'Link' => $Link);
     $this->GetSys('Components')->Talk('Postal', 'Send', $Message);
     return true;
 }
Пример #4
0
 public function _FriendRemove($pAccount, $pRequest)
 {
     $userModel = new cModel('UserAccounts');
     $userModel->Structure();
     $friendModel = new cModel('FriendInformation');
     $friendModel->Structure();
     list($requestUsername, $requestDomain) = explode('@', $pRequest);
     list($accountUsername, $accountDomain) = explode('@', $pAccount);
     $userModel->Retrieve(array('Username' => $requestUsername));
     $userModel->Fetch();
     $requestUsername_uID = $userModel->Get('Account_PK');
     if (!$requestUsername_uID) {
         return false;
     }
     $friendModel->Retrieve(array('Owner_FK' => $requestUsername_uID, 'Username' => $accountUsername, 'Domain' => $accountDomain));
     if ($friendModel->Get('Total') > 0) {
         // Record found, so approve it.
         $friendModel->Fetch();
         $friendModel->Delete();
         return true;
     } else {
         // Record doesn't exist, so just return true;
         return true;
     }
 }