2013-10-05 12:55:03 +02:00
|
|
|
<?php
|
2013-10-05 21:24:20 +02:00
|
|
|
class PostController
|
2013-10-05 12:55:03 +02:00
|
|
|
{
|
|
|
|
/**
|
2013-10-05 19:24:08 +02:00
|
|
|
* @route /posts
|
|
|
|
* @route /posts/{query}
|
|
|
|
* @validate query .*
|
2013-10-05 12:55:03 +02:00
|
|
|
*/
|
2013-10-05 19:24:08 +02:00
|
|
|
public function listAction($query = null)
|
2013-10-05 12:55:03 +02:00
|
|
|
{
|
2013-10-05 22:52:55 +02:00
|
|
|
#redirect requests in form of /posts/?query=... to canonical address
|
|
|
|
$formQuery = InputHelper::get('query');
|
|
|
|
if (!empty($formQuery))
|
|
|
|
{
|
|
|
|
$url = \Chibi\UrlHelper::route('post', 'list', ['query' => $formQuery]);
|
|
|
|
\Chibi\UrlHelper::forward($url);
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
2013-10-05 21:22:28 +02:00
|
|
|
$this->context->subTitle = 'browsing posts';
|
2013-10-05 22:52:55 +02:00
|
|
|
$this->context->searchQuery = $query;
|
2013-10-05 19:24:08 +02:00
|
|
|
throw new Exception('Not implemented');
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @route /post/upload
|
|
|
|
*/
|
|
|
|
public function uploadAction()
|
|
|
|
{
|
2013-10-05 21:22:28 +02:00
|
|
|
$this->context->subTitle = 'upload';
|
2013-10-05 19:24:08 +02:00
|
|
|
throw new Exception('Not implemented');
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @route /post/{id}
|
|
|
|
*/
|
|
|
|
public function showAction($id)
|
|
|
|
{
|
2013-10-05 21:22:28 +02:00
|
|
|
$this->context->subTitle = 'showing @' . $id;
|
2013-10-05 19:24:08 +02:00
|
|
|
throw new Exception('Not implemented');
|
2013-10-05 12:55:03 +02:00
|
|
|
}
|
2013-10-05 22:52:55 +02:00
|
|
|
|
|
|
|
/**
|
|
|
|
* @route /favorites
|
|
|
|
*/
|
|
|
|
public function favoritesAction()
|
|
|
|
{
|
|
|
|
$this->listAction('favmin:1');
|
|
|
|
}
|
2013-10-05 12:55:03 +02:00
|
|
|
}
|