# HG changeset patch # User Zoe Hong # Date 1428497821 -7200 # Node ID 26d8c4c43d86c41dad018a3f7889af30b89ebbbb # Parent 359f48d58cbcdbb715f34bcc6c96bd315d0ce466 minor checking for variable/index in php diff -r 359f48d58cbc -r 26d8c4c43d86 controllers/extractapp.php --- 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; diff -r 359f48d58cbc -r 26d8c4c43d86 models/extractapp.php --- a/models/extractapp.php Wed Apr 08 14:22:44 2015 +0200 +++ b/models/extractapp.php Wed Apr 08 14:57:01 2015 +0200 @@ -41,7 +41,7 @@ $stringInput = $lg_text; $stringInput = preg_replace("/ /u", "○", $stringInput); $stringInput = preg_replace("/\n/u", "
", $stringInput); - $stringInput = preg_replace("/【(.*?)】/u", "【\\1】", $stringInput); + $stringInput = preg_replace("/【(.*?)】/u", "【book_id."&pages=\\1&entry=0\" target=\"_bookImg\">\\1】", $stringInput); $lg_text = $stringInput; $this->lg_text = $lg_text; @@ -106,41 +106,41 @@ public function GetInfoFromPreviousPage($_postdata) { - if ($_postdata['fileId']) { + if (isset($_postdata['fileId'])) { $this->file_id = $_postdata['fileId']; } - if ($_postdata['sectionId']) { + if (isset($_postdata['sectionId'])) { $this->section_id = $_postdata['sectionId']; } - if ($_postdata['text']) { + if (isset($_postdata['text'])) { $this->lg_text = $_postdata['text']; } - if ($_postdata['branchId']) { + if (isset($_postdata['branchId'])) { $this->branch_id = $_postdata['branchId']; } - if ($_postdata['userId']) { + if (isset($_postdata['userId'])) { $this->user_id = $_postdata['userId']; } - if ($_postdata['topic_id']) { + if (isset($_postdata['topic_id'])) { $this->topic = $_postdata['topic_id']; } - if ($_postdata['sectionName']) { + if (isset($_postdata['sectionName'])) { $this->section_name = $_postdata['sectionName']; } - if ($_postdata['bookName']) { + if (isset($_postdata['bookName'])) { $this->book_name = $_postdata['bookName']; } - if ($_postdata['bookId']) { + if (isset($_postdata['bookId'])) { $this->book_id = $_postdata['bookId']; } - if ($_postdata['currentFileId']) { + if (isset($_postdata['currentFileId'])) { $this->current_fileId = $_postdata['currentFileId']; } - if ($_postdata['taglistArray']) { + if (isset($_postdata['taglistArray'])) { $this->taglist_infile = json_decode($_postdata['taglistArray']); } - if ($_postdata['book_meta']) { + if (isset($_postdata['book_meta'])) { $this->book_meta = json_decode($_postdata['book_meta']); } @@ -1246,7 +1246,7 @@ //$listString = preg_replace("/\n/u", "|", $listString); $wordlistArray2 = explode( "\n", $listString ); - usort($wordlistArray2,'sortFunction'); + //usort($wordlistArray2,'sortFunction'); foreach ( $wordlistArray2 as $index=>$value ) { $wordlistArray2[$index] = implode("○?", preg_split("/(?