From e7c7881afb89b67fef1eb92db851d1ed0d04fa13 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mike=20Schw=C3=B6rer?= Date: Mon, 16 Jun 2014 19:48:59 +0200 Subject: [PATCH] Added "update" API --- .idea/workspace.xml | 251 +++++++++++--------- www/protected/components/MSController.php | 4 +- www/protected/config/main.php | 5 + www/protected/controllers/APIController.php | 54 +++++ www/protected/views/api/update.php | 5 + www/protected/views/layouts/main.php | 2 +- 6 files changed, 210 insertions(+), 111 deletions(-) create mode 100644 www/protected/controllers/APIController.php create mode 100644 www/protected/views/api/update.php diff --git a/.idea/workspace.xml b/.idea/workspace.xml index 6cac178..dde04d6 100644 --- a/.idea/workspace.xml +++ b/.idea/workspace.xml @@ -63,37 +63,28 @@ - - + + - + - - + + - + - - + + - - - - - - - - - - + @@ -102,25 +93,25 @@ - + - - + + - + - - + + - + @@ -139,8 +130,6 @@ @@ -371,8 +362,30 @@ + + - - @@ -729,41 +746,11 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - @@ -774,11 +761,6 @@ - - - - - @@ -789,11 +771,6 @@ - - - - - @@ -899,7 +876,9 @@ - + + + @@ -922,13 +901,6 @@ - - - - - - - @@ -936,13 +908,6 @@ - - - - - - - @@ -978,13 +943,6 @@ - - - - - - - @@ -992,30 +950,107 @@ - + - - - - - - - - + - + - + - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/www/protected/components/MSController.php b/www/protected/components/MSController.php index e774491..ae2e78e 100644 --- a/www/protected/components/MSController.php +++ b/www/protected/components/MSController.php @@ -5,9 +5,9 @@ */ class MSController extends CController { - public $layout='//layouts/main'; + public $layout = '//layouts/main'; - public $breadcrumbs=array(); + public $breadcrumbs = array(); public $selectedNav = ''; diff --git a/www/protected/config/main.php b/www/protected/config/main.php index f5ccedc..33f2e99 100644 --- a/www/protected/config/main.php +++ b/www/protected/config/main.php @@ -74,6 +74,11 @@ return ArrayX::merge( 'programupdates/' => 'programupdates/index', + 'update.php' => 'api/update', + 'update.php/' => 'api/update2', + 'update' => 'api/update', + 'update/' => 'api/update2', + 'downloads/details.php' => 'programs/index', // Compatibility 'downloads/downloads.php' => 'programs/index', // Compatibility 'downloads/' => 'programs/view', // Compatibility diff --git a/www/protected/controllers/APIController.php b/www/protected/controllers/APIController.php new file mode 100644 index 0000000..72e4568 --- /dev/null +++ b/www/protected/controllers/APIController.php @@ -0,0 +1,54 @@ +array('*'), + ), + ); + } + + public function actionUpdate() + { + if (! isset($_GET['Name'])) { + throw new CHttpException(404,'Invalid Request - [Name] missing'); + return; + } + + $Name = $_GET['Name']; + + $this->actionUpdate2($Name); + } + + public function actionUpdate2($Name) + { + $data = ProgramUpdates::model()->findByAttributes(['Name' => $Name]); + + if (! isset($_GET['Name'])) { + throw new CHttpException(404,'Invalid Request - [Name] not found'); + return; + } + + $this->render('update', ['data' => $data]); + } +} \ No newline at end of file diff --git a/www/protected/views/api/update.php b/www/protected/views/api/update.php new file mode 100644 index 0000000..78c7495 --- /dev/null +++ b/www/protected/views/api/update.php @@ -0,0 +1,5 @@ +Name."
".$data->Version."
".$data->Link); \ No newline at end of file diff --git a/www/protected/views/layouts/main.php b/www/protected/views/layouts/main.php index 1051a13..a3caf28 100644 --- a/www/protected/views/layouts/main.php +++ b/www/protected/views/layouts/main.php @@ -88,7 +88,7 @@ ?>