Example #1
0
 public function register_app()
 {
     try {
         $this->assertLoggedIn();
         $this->setTitle("Register your App");
         $this->set('area', 'app');
         $app = new OAuthConsumer();
         $form = $this->_AppConsumerForm($app);
         $form->action = "/app/register";
         $form->submitText = "Register App";
         $this->set('form', $form);
         if ($form->checkSubmitAndValidate($this->args())) {
             $app = OAuthConsumer::create($this->args('name'), $this->args('app_url'));
             Activity::log("registered a new app named " . $app->getLink() . ".");
             $this->forwardToUrl($app->getUrl());
         }
     } catch (Exception $e) {
         $this->setTitle('Error');
         $this->set('megaerror', $e->getMessage());
     }
 }