Exemplo n.º 1
0
 public function download()
 {
     //Utils::isLogged();
     if (isset($_GET['p'])) {
         $id = $_GET['p'];
         $userId = Utils::getUserID();
         $u_id = Projects::getUserIdForProject($id);
         if ($userId == $u_id) {
             return '/home/download/p?p=' . $_GET['p'];
             //                $this->downloadFinally($id);
         }
         $premium = Projects::isPremium(Utils::getUserID());
         if ($premium == 1) {
             return '/home/download/p?p=' . $_GET['p'];
             //                $this->downloadFinally($id);
         }
         $isrequested = User::isRequested($id, Utils::getUserID());
         if (!empty($isrequested)) {
             return '/home/download/p?p=' . $_GET['p'];
         }
         $sh = Projects::hasUserAnyProject($userId);
         if (empty($sh)) {
             return 2;
         } else {
             return 1;
         }
     } else {
         Redirect::to('home')->send();
     }
 }