Example #1
0
 public static function fromRow($row, Forum $forum = null)
 {
     global $user, $userManager, $db;
     $topic = new self(!is_null($forum) ? $forum : $row->forum_id, $row->user_id, $row->topic_title, $row->id);
     $topic->setImportant($row->topic_important == '1');
     $topic->setClosed($row->topic_closed == '1');
     // if user is logged in, use new entry-icons
     if ($userManager->loggedIn()) {
         $available = max($row->mark_time, $user->getRegisterDate()) < $topic->getLastPost()->getDate() ? true : false;
         $topic->setNewEntriesAvailable($available);
     }
     return $topic;
 }
Example #2
0
 public function sub($path)
 {
     $base = new self(strval($path));
     $sub = new self();
     $a = $this->getSegments();
     $b = $base->getSegments();
     $s = array();
     $i = 0;
     while (isset($a[$i]) && isset($b[$i]) && $a[$i] == $b[$i]) {
         $sub->setAbsolute(false);
         $i++;
     }
     $sub->setSegments(\array_slice($a, $i));
     if ($i) {
         $sub->setAbsolute(false);
     }
     $sub->setClosed($this->isClosed());
     return $sub;
 }