Example #1
0
 public function view_app()
 {
     $this->assertLoggedIn();
     try {
         $app = new OAuthConsumer($this->args('app_id'));
         if (!$app->isHydrated()) {
             throw new Exception("This app does not exist.");
         }
         if (!User::$me->isAdmin() && $app->get('user_id') != User::$me->id) {
             throw new Exception("You are not authorized to view this app.");
         }
         $this->setTitle("View App - " . $app->getName());
         $this->set('app', $app);
     } catch (Exception $e) {
         $this->setTitle('View App - Error');
         $this->set('megaerror', $e->getMessage());
     }
 }
Example #2
0
 public function delete_app()
 {
     $this->assertLoggedIn();
     $this->set('area', 'app');
     try {
         $app = new OAuthConsumer($this->args('app_id'));
         if (!$app->isHydrated()) {
             throw new Exception("This app does not exist.");
         }
         if (!User::$me->isAdmin() && $app->get('user_id') != User::$me->id) {
             throw new Exception("You are not authorized to delete this app.");
         }
         $this->set('app', $app);
         $this->setTitle('Delete App - ' . $app->getName());
         if ($this->args('submit')) {
             Activity::log("deleted the app named <strong>" . $app->getName() . "</strong>.");
             $app->delete();
             $this->forwardToUrl("/apps");
         }
     } catch (Exception $e) {
         $this->setTitle('Delete App - Error');
         $this->set('megaerror', $e->getMessage());
     }
 }