public function isAccessible($objectID, $validateWritePermission = false)
 {
     // check object id
     $news = new News($objectID);
     if (!$news->newsID || !$news->canRead()) {
         return false;
     }
     return true;
 }
Пример #2
0
 public function get(UserOnline $user, $languageVariable = '')
 {
     $news = new News($user->objectID);
     if ($news->newsID != 0) {
         if ($news->isVisible()) {
             return WCF::getLanguage()->getDynamicVariable($languageVariable, array('news' => $news));
         }
     }
     return '';
 }
Пример #3
0
 public function getIpLog()
 {
     // get ip addresses of the author
     $authorIpAddresses = News::getIpAddressByAuthor($this->news->userID, $this->news->username, $this->news->ipAddress);
     // resolve hostnames
     $newIpAddresses = array();
     foreach ($authorIpAddresses as $ipAddress) {
         $ipAddress = UserUtil::convertIPv6To4($ipAddress);
         $newIpAddresses[] = array('hostname' => @gethostbyaddr($ipAddress), 'ipAddress' => $ipAddress);
     }
     $authorIpAddresses = $newIpAddresses;
     // get other users of this ip address
     $otherUsers = array();
     if ($this->news->ipAddress) {
         $otherUsers = News::getAuthorByIpAddress($this->news->ipAddress, $this->news->userID, $this->news->username);
     }
     $ipAddress = UserUtil::convertIPv6To4($this->news->ipAddress);
     if ($this->news->userID) {
         $sql = "SELECT\tregistrationIpAddress\n\t\t\t\tFROM\twcf" . WCF_N . "_user\n\t\t\t\tWHERE\tuserID = ?";
         $statement = WCF::getDB()->prepareStatement($sql);
         $statement->execute(array($this->news->userID));
         $row = $statement->fetchArray();
         if ($row !== false && $row['registrationIpAddress']) {
             $registrationIpAddress = UserUtil::convertIPv6To4($row['registrationIpAddress']);
             WCF::getTPL()->assign(array('registrationIpAddress' => array('hostname' => @gethostbyaddr($registrationIpAddress), 'ipAddress' => $registrationIpAddress)));
         }
     }
     WCF::getTPL()->assign(array('authorIpAddresses' => $authorIpAddresses, 'ipAddress' => array('hostname' => @gethostbyaddr($ipAddress), 'ipAddress' => $ipAddress), 'otherUsers' => $otherUsers, 'news' => $this->news));
     return array('newsID' => $this->news->newsID, 'template' => WCF::getTPL()->fetch('newsIpAddress', 'cms'));
 }