diff --git a/appinfo/application.php b/appinfo/application.php index 7caf21c..8e04382 100644 --- a/appinfo/application.php +++ b/appinfo/application.php @@ -14,7 +14,7 @@ namespace OCA\OcSms\AppInfo; use \OCP\AppFramework\App; -use \OCA\OcSms\Controller\PageController; +use \OCA\OcSms\Controller\SmsController; class Application extends App { @@ -28,9 +28,10 @@ class Application extends App { /** * Controllers */ - $container->registerService('PageController', function($c) { - return new PageController( - $c->query('AppName'), + + $container->registerService('SmsController', function($c) { + return new SmsController( + $c->query('AppName'), $c->query('Request'), $c->query('UserId') ); @@ -42,9 +43,7 @@ class Application extends App { */ $container->registerService('UserId', function($c) { return \OCP\User::getUser(); - }); - + }); + } - - -} \ No newline at end of file +} diff --git a/appinfo/routes.php b/appinfo/routes.php index 9ae205d..ca43952 100644 --- a/appinfo/routes.php +++ b/appinfo/routes.php @@ -22,6 +22,5 @@ namespace OCA\OcSms\AppInfo; $application = new Application(); $application->registerRoutes($this, array('routes' => array( - array('name' => 'page#index', 'url' => '/', 'verb' => 'GET'), - array('name' => 'page#do_echo', 'url' => '/echo', 'verb' => 'POST'), + array('name' => 'sms#push', 'url' => '/push', 'verb' => 'POST'), ))); diff --git a/controller/pagecontroller.php b/controller/pagecontroller.php deleted file mode 100644 index 7292662..0000000 --- a/controller/pagecontroller.php +++ /dev/null @@ -1,54 +0,0 @@ - - * @copyright Loic Blot 2014 - */ - -namespace OCA\OcSms\Controller; - - -use \OCP\IRequest; -use \OCP\AppFramework\Http\TemplateResponse; -use \OCP\AppFramework\Controller; - -class PageController extends Controller { - - private $userId; - - public function __construct($appName, IRequest $request, $userId){ - parent::__construct($appName, $request); - $this->userId = $userId; - } - - - /** - * CAUTION: the @Stuff turn off security checks, for this page no admin is - * required and no CSRF check. If you don't know what CSRF is, read - * it up in the docs or you might create a security hole. This is - * basically the only required method to add this exemption, don't - * add it to any other method if you don't exactly know what it does - * - * @NoAdminRequired - * @NoCSRFRequired - */ - public function index() { - $params = array('user' => $this->userId); - return new TemplateResponse('ocsms', 'main', $params); // templates/main.php - } - - - /** - * Simply method that posts back the payload of the request - * @NoAdminRequired - */ - public function doEcho($echo) { - return array('echo' => $echo); - } - - -} \ No newline at end of file diff --git a/controller/smscontroller.php b/controller/smscontroller.php new file mode 100644 index 0000000..12136c2 --- /dev/null +++ b/controller/smscontroller.php @@ -0,0 +1,33 @@ + + * @copyright Loic Blot 2014 + */ + +namespace OCA\OcSms\Controller; + + +use \OCP\IRequest; +use \OCP\AppFramework\Http\TemplateResponse; +use \OCP\AppFramework\Controller; + +class SmsController extends Controller { + + private $userId; + + public function __construct($appName, IRequest $request, $userId){ + parent::__construct($appName, $request); + $this->userId = $userId; + } + + public function push() { + return array("test" => "test2"); + } + + +}