public function treat($parameters)
 {
     if (isset($parameters[2])) {
         // get user id
         $authorized = new DreawAuthorize();
         $user_id = $authorized->getDeveloperId();
         // get path to image
         if ($parameters[2] == 'profile_image') {
             if (isset($parameters[3])) {
                 $user_id = $parameters[3];
             }
             $path = realpath('common/libs/dev_data/' . $user_id . '/images/' . $parameters[2] . '.jpg');
             header('Content-type: image/jpeg');
             if (file_exists($path)) {
                 readfile($path);
                 exit(0);
             } else {
                 readfile('common/libs/template/img/profile_small.jpg');
                 exit(0);
             }
         } else {
             if (isset($parameters[3]) & isset($parameters[4])) {
                 $path = realpath('common/libs/dev_data/' . $parameters[4] . '/tracker/' . $parameters[2] . '.' . $parameters[3]);
                 header('Content-Type: application/octet-stream');
                 header("Content-Transfer-Encoding: Binary");
                 header("Content-disposition: attachment; filename=\"" . basename($path) . "\"");
                 readfile($path);
                 exit(0);
             }
         }
         // end code
         exit(0);
     } else {
         header('Location: /app/');
         exit(0);
     }
 }
Example #2
0
 public function getNewestChangeLog()
 {
     // get users last viewed changelog
     $this->_DB->query("SELECT changelog_viewed FROM users WHERE uid = :uid LIMIT 1");
     $this->_DB->bind(['uid' => $this->_SESS->getSess('uid_logged')]);
     $this->_DB->execute();
     $changelog_viewed = $this->_DB->fetchAll();
     $changelog_viewed = $changelog_viewed[0]['changelog_viewed'];
     // get newest changelog
     $this->_DB->query("SELECT * FROM changelog ORDER BY id DESC LIMIT 1");
     $this->_DB->execute();
     $newest_changelog = $this->_DB->fetchAll();
     if ($newest_changelog[0]['id'] != $changelog_viewed) {
         $data = array('view' => 'true', 'text' => $newest_changelog[0]['text']);
         // update changelog_viewed
         // get user id
         $authorize = new DreawAuthorize();
         $user_id = $authorize->getDeveloperId();
         $this->_DB->query('UPDATE users SET changelog_viewed = :changelog_viewed WHERE id = :id');
         $this->_DB->bind(['changelog_viewed' => $newest_changelog[0]['id'], 'id' => $user_id]);
         $this->_DB->execute();
     } else {
         $data = array('view' => 'false', 'text' => '');
     }
     return $data;
 }