Beispiel #1
0
 public function Status($pData = null)
 {
     if ($this->_Source != 'Component') {
         return false;
     }
     $this->_Focus = $this->Talk('User', 'Focus');
     $this->_Current = $this->Talk('User', 'Current');
     include ASD_PATH . 'components/page/models/post.php';
     $Posts = new cPagePostModel();
     include ASD_PATH . 'components/page/models/references.php';
     $References = new cPageReferencesModel();
     $Posts->RetrieveCurrent($this->_Focus->Id);
     if ($Posts->Get("Total") == 0) {
         return false;
     }
     $Posts->Fetch();
     $References->Retrieve(array("Identifier" => $Posts->Get("Identifier")));
     if ($References->Get("Total") == 0) {
         return false;
     }
     $References->Fetch();
     $return = array();
     $Identifier = $References->Get('Identifier');
     $Access = $this->Talk('Privacy', 'Check', array('Type' => 'Post', 'Identifier' => $Identifier));
     $return['Content'] = $Posts->Get('Content');
     $return['Stamp'] = $References->Get('Stamp');
     if ($Access) {
         return $return;
     } else {
         // If the person viewing is the focus user, grant access
         if ($this->_Focus->Account == $this->_Current->Account) {
             return $return;
         } else {
             return false;
         }
     }
     return false;
 }
Beispiel #2
0
 public function Post($pComment, $pPrivacy, $pUserId, $pOwner, $pCurrent = false)
 {
     $Identifier = $this->CreateUniqueIdentifier();
     $privacyData = array('Privacy' => $pPrivacy, 'Type' => 'Post', 'Identifier' => $Identifier);
     $this->GetSys('Components')->Talk('Privacy', 'Store', $privacyData);
     $this->Protect('Post_PK', null);
     $this->Set('User_FK', $pUserId);
     $this->Set('Owner', $pOwner);
     $this->Set('Identifier', $Identifier);
     $this->Set('Content', $pComment);
     if ($pCurrent) {
         $this->Set('Current', (int) true);
         $this->ClearCurrent($pUserId);
     } else {
         $this->Set('Current', '0');
     }
     $this->Save();
     include_once ASD_PATH . '/components/page/models/references.php';
     $Reference = new cPageReferencesModel();
     $Reference->Create('Post', $Identifier, $pUserId);
     return true;
 }