function __construct()
 {
     $this->view = new View();
     $this->helper = new Helper();
     $this->dbh = new \PDO("mysql:host={$this->helper->config['db_credentials']['host']};\n            dbname={$this->helper->config['db_credentials']['dbname']}", $this->helper->config['db_credentials']['user'], $this->helper->config['db_credentials']['pass']);
     $this->model = new Model($this->dbh);
     Session::start();
 }
 public function action_update_media()
 {
     $this->instagram->setAccessToken(Session::read('access_token'));
     $info = $this->update();
     $images = array();
     $i = 0;
     foreach ($info['userMedia']->data as $data) {
         $images[$i]['url'] = $data->images->standard_resolution->url;
         $images[$i]['likes'] = $data->likes->count;
         $images[$i]['comments'] = $data->comments->count;
         $i++;
     }
     echo json_encode(array('images' => $images));
 }
 function action_index()
 {
     Session::destroy();
     header('Location: http://' . $_SERVER['SERVER_NAME'] . '/');
 }