/** * Load author object and set access level. * * @param string|int $author Author username or user id. * @throws \Exception Throws exception if user is not found. * @return null */ protected function load_author($author) { $this->author = new \titania_author(false); if (!$this->author->load($author)) { throw new \Exception($this->user->lang['AUTHOR_NOT_FOUND']); } $this->is_owner = $this->user->data['user_id'] == $this->author->user_id; // Check to see if the currently accessing user is the author if ($this->access->is_public() && $this->is_owner) { $this->access->set_level(access::AUTHOR_LEVEL); } }
redirect(titania_url::build_url('')); break; /** * Rate something & remove a rating from something */ /** * Rate something & remove a rating from something */ case 'rate': $type = request_var('type', ''); $id = request_var('id', 0); $value = request_var('value', -1.0); switch ($type) { case 'author': $object = new titania_author(); $object->load($id); $object->get_rating(); $redirect = $object->get_url(); if (!$object || !$object->author_id) { trigger_error('AUTHOR_NOT_FOUND'); } break; case 'contrib': $object = new titania_contribution(); $object->load($id); $object->get_rating(); $redirect = $object->get_url(); if (!$object) { trigger_error('CONTRIB_NOT_FOUND'); } break;