diff models/extractapp.php @ 73:2daef8e36214 extractapp

minor modification
author Zoe Hong <zhong@mpiwg-berlin.mpg.de>
date Wed, 08 Apr 2015 16:17:50 +0200
parents 26d8c4c43d86
children 60b5a94163c3
line wrap: on
line diff
--- a/models/extractapp.php	Wed Apr 08 15:45:53 2015 +0200
+++ b/models/extractapp.php	Wed Apr 08 16:17:50 2015 +0200
@@ -84,13 +84,12 @@
         $lg_text_url = $this->get_text_from_sectionId_url.$this->section_id;
         $lg_text = file_get_contents($lg_text_url);
 
-        
 
         $stringInput = $lg_text;
         $stringInput = preg_replace("/<(.*?)>/u", "○", $stringInput);
         $stringInput = preg_replace("/ /u", "○", $stringInput);
         $stringInput = preg_replace("/\n/u", "<br>", $stringInput);
-        $stringInput = preg_replace("/【(.*?)】/u", "【<a href=\"review_index_xml_images.php?books_id=".$bookId."&pages=\\1&entry=0\" target=\"_bookImg\">\\1</a>】", $stringInput);
+        $stringInput = preg_replace("/【(.*?)】/u", "【<a href=\"review_index_xml_images.php?books_id=".$this->book_id."&pages=\\1&entry=0\" target=\"_bookImg\">\\1</a>】", $stringInput);
         $lg_text = $stringInput;
 
         $this->lg_text = $lg_text;
@@ -124,7 +123,6 @@
         if (isset($_postdata['topic_id'])) {
             $this->topic = $_postdata['topic_id'];
         }
-
         if (isset($_postdata['sectionName'])) {
             $this->section_name = $_postdata['sectionName'];
         }
@@ -144,11 +142,9 @@
             $this->book_meta = json_decode($_postdata['book_meta']);
         }
 
-
     }
 
 
-
     private function TaglistSubsetIn($list1, $list2) {    // $l1 is a subset of $l2 or not
         // l1 and l2: array( $row['id'], $row['name'], $row['tag'], $row['color'] )
         $cnt_list1 = count($list1);
@@ -274,8 +270,12 @@
 
     public function UpdateInfoByResponseFromLGService($response) {
         
-        $response_file = $response["file"];
-        $response_branch = $response["branch"];
+        if (isset($response["file"])) {
+            $response_file = $response["file"];
+        }
+        if (isset($response["branch"])) {
+            $response_branch = $response["branch"];
+        }
 
         $status = (string)$response["status"];
         if ($status == "ok") {