public function onInit($param) { parent::onInit($param); $id = TPropertyValue::ensureInteger($this->Request['id']); $this->_category = $this->DataAccess->queryCategoryByID($id); if ($this->_category === null) { throw new BlogException(500, 'category_id_invalid', $id); } }
public function onInit($param) { parent::onInit($param); $this->_posts = $this->DataAccess->queryPosts($this->getPostFilter(), $this->getCategoryFilter(), 'ORDER BY a.status DESC, create_time DESC', 'LIMIT ' . $this->getPageOffset() . ',' . $this->getPageSize()); if ($this->Request['cat'] !== null) { $catID = TPropertyValue::ensureInteger($this->Request['cat']); $this->_category = $this->DataAccess->queryCategoryByID($catID); $this->CategoryPanel->Visible = true; } $this->Title = $this->Application->Parameters['SiteTitle']; }
public function onInit($param) { parent::onInit($param); $id = TPropertyValue::ensureInteger($this->Request['id']); $this->_postRecord = $this->DataAccess->queryPostByID($id); if ($this->_postRecord === null) { throw new BlogException(500, 'post_id_invalid', $id); } // only the author and admin can edit the post if (!$this->User->IsAdmin && $this->User->ID !== $this->_postRecord->AuthorID) { throw new BlogException(500, 'post_edit_disallowed', $id); } }
public function onInit($param) { parent::onInit($param); if (($id = $this->Request['id']) !== null) { $id = TPropertyValue::ensureInteger($id); } else { $id = $this->User->ID; } if (($this->_userRecord = $this->DataAccess->queryUserByID($id)) === null) { throw new BlogException(500, 'profile_id_invalid', $id); } $this->_userRecord->Email = strtr(strtoupper($this->_userRecord->Email), array('@' => ' at ', '.' => ' dot ')); }
public function onInit($param) { parent::onInit($param); $id = TPropertyValue::ensureInteger($this->Request['id']); $this->_post = $this->DataAccess->queryPostByID($id); if ($this->_post === null) { throw new BlogException(500, 'post_id_invalid', $id); } // if post is not published, only the author and admin can view it if ($this->_post->Status !== PostRecord::STATUS_PUBLISHED && $this->_post->Status !== PostRecord::STATUS_STICKY && !$this->User->IsAdmin && $this->User->ID !== $this->_post->AuthorID) { throw new BlogException(500, 'post_view_disallowed', $id); } $this->Title = htmlentities($this->_post->Title, ENT_QUOTES, 'UTF-8'); }
public function onInit($param) { parent::onInit($param); if (($id = $this->Request['id']) !== null) { $id = TPropertyValue::ensureInteger($id); if (!$this->User->IsAdmin && $this->User->ID !== $id) { throw new BlogException(500, 'profile_edit_disallowed', $id); } } else { $id = $this->User->ID; } if (($this->_userRecord = $this->DataAccess->queryUserByID($id)) === null) { throw new BlogException(500, 'profile_id_invalid', $id); } }
public function onInit($param) { parent::onInit($param); $this->_posts = $this->DataAccess->queryPostsSearch($this->getPostKeywords(), 'ORDER BY create_time DESC', 'LIMIT ' . $this->getPageOffset() . ',' . $this->getPageSize()); }