/** * @param int $mesid * @param string|null $direction * @param mixed $hold * * @return int */ public function getPostLocation($mesid, $direction = null, $hold = null) { if (is_null($direction)) { $direction = KunenaUserHelper::getMyself()->getMessageOrdering(); } if (!isset($this->lastread)) { $this->lastread = $this->last_post_id; $this->unread = 0; } if ($mesid == 'unread') { $mesid = $this->lastread; } if ($this->moved_id || !KunenaUserHelper::getMyself()->isModerator($this->getCategory())) { if ($mesid == 'first' || $mesid == $this->first_post_id) { return $direction == 'asc' ? 0 : $this->posts - 1; } if ($mesid == 'last' || $mesid == $this->last_post_id) { return $direction == 'asc' ? $this->posts - 1 : 0; } if ($mesid == $this->unread) { return $direction == 'asc' ? $this->posts - max($this->unread, 1) : 0; } } if ($mesid == 'first') { $direction = $direction == 'asc' ? 0 : 'both'; } if ($mesid == 'last') { $direction = $direction == 'asc' ? 'both' : 0; } return KunenaForumMessageHelper::getLocation($mesid, $direction, $hold); }
public function getLastPostLocation($direction = 'asc', $hold = null) { if (!$this->_me->isModerator($this->id)) return $direction = 'asc' ? $this->last_topic_posts-1 : 0; return KunenaForumMessageHelper::getLocation($this->last_post_id, $direction, $hold); }
public function getPostLocation($mesid, $direction = 'asc', $hold=null) { if (!isset($this->lastread)) { $this->lastread = $this->last_post_id; $this->unread = 0; } if ($mesid == 'unread') $mesid = $this->lastread; if ($this->moved_id || !$this->_me->isModerator($this->category_id)) { if ($mesid == 'first' || $mesid == $this->first_post_id) return $direction = 'asc' ? 0 : $this->posts-1; if ($mesid == 'last' || $mesid == $this->last_post_id) return $direction = 'asc' ? $this->posts-1 : 0; if ($mesid == $this->unread) return $direction = 'asc' ? $this->posts - max($this->unread, 1) : 0; } if ($mesid == 'first') $direction == 'asc' ? 0 : 'both'; if ($mesid == 'last') $direction == 'asc' ? 'both' : 0; if (!$direction) return 0; return KunenaForumMessageHelper::getLocation($mesid, $direction, $hold); }