protected function dashboard()
 {
     //$post
     global $rep, $view;
     $data = array();
     $usr = $_SESSION['username'];
     $data['stories'] = postModel::getPostsByUsername($usr);
     require_once $view['authordashboard'];
 }
 protected function search()
 {
     global $rep, $view;
     $research_types = array('keyword', 'author', 'tag');
     if (isset($_POST['search'])) {
         $researchtype = isset($_POST['searchtype']) ? $_POST['searchtype'] : 'keyword';
         $researchtag = isset($_POST['searchtags']) ? $_POST['searchtags'] : '';
         $host = $_SERVER['HTTP_HOST'];
         $uri = rtrim(dirname($_SERVER['PHP_SELF']), '/\\');
         $extra = 'search/' . $researchtype . "/" . $researchtag;
         header("Location: http://{$host}{$uri}/{$extra}");
     } else {
         $researchtype = isset($_GET['arg1']) ? $_GET['arg1'] : 'keyword';
         $researchtag = isset($_GET['arg2']) ? $_GET['arg2'] : '';
         if (in_array($researchtype, $research_types)) {
             switch ($researchtype) {
                 case 'author':
                     if ($researchtag == '') {
                         $data['data'] = postModel::getAllposts();
                     } else {
                         $data['data'] = postModel::getPostsByUsername($researchtag);
                     }
                     require_once $view['search'];
                     break;
                 case 'keyword':
                     if ($researchtag == '') {
                         $data['data'] = postModel::getAllposts();
                     } else {
                         $data['data'] = postModel::getPostsByTitle($researchtag);
                     }
                     require_once $view['search'];
                     break;
                 case 'tag':
                     break;
             }
         }
     }
     require_once $view['search'];
 }