diff controllers/extractapp.php @ 71:26d8c4c43d86 extractapp

minor checking for variable/index in php
author Zoe Hong <zhong@mpiwg-berlin.mpg.de>
date Wed, 08 Apr 2015 14:57:01 +0200
parents edb8a2e8ce84
children 2daef8e36214
line wrap: on
line diff
--- a/controllers/extractapp.php	Wed Apr 08 14:22:44 2015 +0200
+++ b/controllers/extractapp.php	Wed Apr 08 14:57:01 2015 +0200
@@ -15,8 +15,11 @@
 
     protected function TaggingText() {
         $viewmodel = $this->viewmodel;
-               
-        switch ($this->postdata['func']) {
+        
+        if (isset($this->postdata['func'])) {
+            $func = $this->postdata['func'];
+        }
+        switch ($func) {
             case 'SaveFullText':
                 $viewmodel->SaveFullText($this->postdata);          
                 $this->ReturnView($viewmodel->StartTagging(), true); 
@@ -100,7 +103,10 @@
 
     protected function EditWordlist() {
         $viewmodel = $this->viewmodel;
-        switch ($this->postdata['func']) {
+        if (isset($this->postdata['func'])) {
+            $func = $this->postdata['func'];
+        }
+        switch ($func) {
             case 'AddNewList':
                 $this->ReturnView($viewmodel->AddNewList($this->postdata), true);
                 break;
@@ -108,7 +114,6 @@
                 $this->ReturnView($viewmodel->SaveWordlist($this->postdata), true);
                 break;
             default:    // EditWordlist
-                
                 $this->ReturnView($viewmodel->EditWordlist(), true);    
             break;
          } 
@@ -117,7 +122,10 @@
 
     protected function EditTaglist() {
         $viewmodel = $this->viewmodel;
-        switch ($this->postdata['func']) {
+        if (isset($this->postdata['func'])) {
+            $func = $this->postdata['func'];
+        }
+        switch ($func) {
             case 'NewTagElement':
                 $this->ReturnView($viewmodel->NewTagElement($this->postdata), true);
                 break;
@@ -136,7 +144,10 @@
  
     protected function ConfigTagsInTopic() {
         $viewmodel = $this->viewmodel;
-        switch ($this->postdata['func']) {
+        if (isset($this->postdata['func'])) {
+            $func = $this->postdata['func'];
+        }
+        switch ($func) {
             case 'Update':
                 $viewmodel->UpdateTagsInTopic($this->postdata);
                 break;