Mercurial > hg > extraction-interface
diff develop/models/extractapp.php @ 24:b55f5d3564c4
add some regular expressions and wordlist for topic ??
author | Zoe Hong <zhong@mpiwg-berlin.mpg.de> |
---|---|
date | Fri, 27 Feb 2015 16:35:59 +0100 |
parents | a879f6b9d166 |
children | 4b6d2d7e706e |
line wrap: on
line diff
--- a/develop/models/extractapp.php Wed Feb 25 10:59:45 2015 +0100 +++ b/develop/models/extractapp.php Fri Feb 27 16:35:59 2015 +0100 @@ -202,9 +202,9 @@ $this->file_id = (string)$response_file["id"]; $this->branch_id = (string)$response_branch["id"]; - - $this->messages .= "file_id: ".$this->file_id."<br>"; - $this->messages .= "branch_id: ".$this->branch_id."<br>"; + + //$this->messages .= "file_id: ".$this->file_id."<br>"; + //$this->messages .= "branch_id: ".$this->branch_id."<br>"; } public function SaveFullTextToLGService($_postdata) { @@ -597,7 +597,12 @@ // === for config topic === public function ConfigTagsInTopic($postdata) { - + $topic = $postdata['topic']; + $result = $this->GetTopicByID($topic); + $row = mysql_fetch_assoc($result); + $topic_name = $row['name']; + + /* $query = "SELECT taglist.*, topic_tag_relation.topic_id FROM taglist LEFT JOIN topic_tag_relation ON taglist.id = topic_tag_relation.tag_id ORDER BY `topic_id`"; $result = mysql_query($query); if (!$result) { @@ -607,19 +612,7 @@ while ($row = mysql_fetch_assoc($result)) { array_push($taglistArray, array('id'=>$row['id'],'name'=>$row['name'], 'tag'=>$row['tag'], 'color'=>$row['color'], 'topic_id'=>$row['topic_id']) ); } - - $topic = $postdata['topic']; - $result = $this->GetTopicByID($topic); - $row = mysql_fetch_assoc($result); - $topic_name = $row['name']; - - $data = array(); - $data['taglistArray'] = $taglistArray; - $data['topic'] = $topic; - $data['topic_name'] = $topic_name; - - - + */ // ------ $query = "SELECT taglist.*, topic_tag_relation.topic_id FROM taglist LEFT JOIN topic_tag_relation ON taglist.id = topic_tag_relation.tag_id ORDER BY `topic_id`"; @@ -639,7 +632,7 @@ } } - // check if there's any duplicated tags in tag_tmp_others. remove the duplicated tags + // --- check if there's any duplicated tags in tag_tmp_others. remove the duplicated tags $num_others = count($tag_tmp_others); for ($i=0; $i < $num_others; $i++) { $cnt = 0; @@ -656,7 +649,7 @@ } } - // remove duplicated tags in tag_others that is duplicated with tags in tag_intopic + // --- remove duplicated tags in tag_others that is duplicated with tags in tag_intopic $tag_tmp_others = $tag_others; $tag_others = array(); @@ -675,6 +668,13 @@ } } + // ----- + + + $data = array(); + //$data['taglistArray'] = $taglistArray; + $data['topic'] = $topic; + $data['topic_name'] = $topic_name; $data['tag_intopic'] = $tag_intopic; $data['tag_others'] = $tag_others; @@ -888,9 +888,11 @@ $filename = "data/wordlist/".$postdata['filename']."_".$date.".txt"; $oldFile = file_get_contents("data/wordlist/".$postdata['filename'].".txt"); file_put_contents($filename, $oldFile); - } else { + } + /*else { $filename = "data/wordlist/".$postdata['filename'].".txt"; } + */ if (get_magic_quotes_gpc()) { @@ -900,7 +902,7 @@ } $require = preg_replace("/<br>/u", "<br>", $require); - file_put_contents($filename, $require); + file_put_contents("data/wordlist/".$postdata['filename'].".txt", $require); } /* if ($postdata['text']){ @@ -1040,7 +1042,7 @@ $wordlistArray=""; $result = $this->GetWordlist(); while ($row = mysql_fetch_assoc($result)) { - $listString = file_get_contents("wordlist/".$row['id'].".txt"); + $listString = file_get_contents("data/wordlist/".$row['id'].".txt"); $listString = preg_replace("/<div>/u", "\n", $listString); $listString = preg_replace("/<\/div>/u", "", $listString); $listString = preg_replace("/<span(.*?)>/u", "", $listString);