Example #1
0
 public function actionView($id)
 {
     $query = strtolower($id);
     $article = (new \Stack\Entity\Article())->fetchById($query);
     if (!$article->exists()) {
         return null;
     }
     if ($id != $article->id) {
         \Staq\Util::httpRedirect(\Staq\Util::getModelControllerUrl($article), 301);
     }
     $view = $this->createView();
     $view['article'] = $article;
     return $view;
 }
Example #2
0
 public static function httpRedirectUri($uri, $code = NULL)
 {
     \UString::doStartWith($uri, '/');
     \Staq\Util::httpRedirect(\Staq::App()->getBaseUri() . $uri, $code);
 }