# HG changeset patch # User Zoe Hong # Date 1435247008 -7200 # Node ID bc6ce492f15d32e435adf49879ba12152c0bdb24 # Parent 45cbafdec56e194ee0856e3bb743115b259c1bd5 add passwd in search page, php error log diff -r 45cbafdec56e -r bc6ce492f15d config/config.php --- a/config/config.php Wed Mar 25 16:03:54 2015 +0100 +++ b/config/config.php Thu Jun 25 17:43:28 2015 +0200 @@ -8,17 +8,17 @@ $mysql_server = "localhost"; $mysql_user = "root"; $mysql_password = "admin"; - $server_host = "http://localgazetteers-dev/"; - $lgserver_url = $server_host."LGServer/"; + $server_host = "http://localgazetteers.mpiwg-berlin.mpg.de/"; + $lgserver_url = $server_host."LGServices/"; } else { // localhost - $mysql_database = "Gazetteers"; + $mysql_database = "Gazetteer"; $mysql_server = "localhost"; $mysql_user = "root"; $mysql_password = "root"; $server_host = "http://localhost:1080/localgazetteers-dev/"; - $lgserver_url = "http://localgazetteers-dev/LGServer/"; + $lgserver_url = "http://localgazetteers-dev/LGServices/"; } diff -r 45cbafdec56e -r bc6ce492f15d search.php --- a/search.php Wed Mar 25 16:03:54 2015 +0100 +++ b/search.php Thu Jun 25 17:43:28 2015 +0200 @@ -1,9 +1,7 @@ @@ -15,6 +13,16 @@ + +
關鍵字: (若要搜尋多筆關鍵字請用半型逗號,隔開)
將結果輸出至: .html (請用英文非空白字元命名)
diff -r 45cbafdec56e -r bc6ce492f15d search_function.php --- a/search_function.php Wed Mar 25 16:03:54 2015 +0100 +++ b/search_function.php Thu Jun 25 17:43:28 2015 +0200 @@ -108,65 +108,71 @@ global $system_root_url, $server_host, $lgserver_url; - $fp=fopen("./search_results/".$filename.".html","w"); - fwrite($fp,$header); - $str="view the distribution on the map (click here at the first time)

"; - $str.="view the distribution on the map

"; + if ($fp=fopen("./search_results/".$filename.".html","w")) { + + //$fp=fopen("./search_results/".$filename.".html","w"); + fwrite($fp,$header); + $str="view the distribution on the map (click here at the first time)

"; + $str.="view the distribution on the map

"; - $str.="html version

"; - // $str.="html version

"; - echo $str; - fwrite($fp,$str); - echo sizeof($array)." result(s) of \"".$keywordStr."\" "; - fwrite($fp,sizeof($array)." result(s) of \"".$keywordStr."\"
"); - $str=""; - $str.=""; - $str.=""; - $str.="
#book idbook namelevel1level2periodsection infopagecontent"; - fwrite($fp,$str); - echo $str; - $i=1; - foreach($array as $row){ - $str="
".$i; - $str.="".$row['BOOK_ID']; - $str.="".$row['Name']; - $str.="".$row['LEVEL1']; - $str.="".$row['LEVEL2']; - $str.="".$row['PERIOD']; - $str.=""; + fwrite($fp,$str); + $str.="html version

"; + // $str.="html version

"; + echo $str; + echo sizeof($array)." result(s) of \"".$keywordStr."\" "; + fwrite($fp,sizeof($array)." result(s) of \"".$keywordStr."\"
"); + $str=""; + $str.=""; + $str.=""; + $str.="
#book idbook namelevel1level2periodsection infopagecontent"; fwrite($fp,$str); echo $str; - foreach($row['SECTION'] as $section){ - - $str="
".$section['name']."p".$section['start_page']."-".$section['end_page']."
"; - echo $str; - /* - // redirect to LGServer? - $str="
".$section['name']."p".$section['start_page']."-".$section['end_page']."
"; - echo $str; - $str="
".$section['name']."p".$section['start_page']."-".$section['end_page']."
"; - */ - /* origial - $str="
".$section['name']."p".$section['start_page']."-".$section['end_page']."
"; - echo $str; - $str="
".$section['name']."p".$section['start_page']."-".$section['end_page']."
"; - */ + $i=1; + foreach($array as $row){ + $str="
".$i; + $str.="".$row['BOOK_ID']; + $str.="".$row['Name']; + $str.="".$row['LEVEL1']; + $str.="".$row['LEVEL2']; + $str.="".$row['PERIOD']; + $str.=""; fwrite($fp,$str); - } - $str="".$row['PAGE']; - if($tag==$NO_TAG){ - $str.="".$row['CONTENT']; - }else if($tag==$LOCUST_TEMPLE){ - $str.="".findLocustTempleDescription($row['CONTENT'],$keywordArray,0); + echo $str; + foreach($row['SECTION'] as $section){ + + $str="
".$section['name']."p".$section['start_page']."-".$section['end_page']."
"; + echo $str; + /* + // redirect to LGServer? + $str="
".$section['name']."p".$section['start_page']."-".$section['end_page']."
"; + echo $str; + $str="
".$section['name']."p".$section['start_page']."-".$section['end_page']."
"; + */ + /* origial + $str="
".$section['name']."p".$section['start_page']."-".$section['end_page']."
"; + echo $str; + $str="
".$section['name']."p".$section['start_page']."-".$section['end_page']."
"; + */ + fwrite($fp,$str); + } + $str="
".$row['PAGE']; + if($tag==$NO_TAG){ + $str.="".$row['CONTENT']; + }else if($tag==$LOCUST_TEMPLE){ + $str.="".findLocustTempleDescription($row['CONTENT'],$keywordArray,0); + } + fwrite($fp,$str); + echo $str; + $i++; } - fwrite($fp,$str); - echo $str; - $i++; + + echo "
"; + fwrite($fp,"
"); + fclose($fp); + + } else { + error_log("error when opening file: "."./search_results/".$filename.".html" ,0); } - - echo ""; - fwrite($fp,""); - fclose($fp); } function findLocustTempleDescription($str,$keywordArray,$findUnknownTemple){ @@ -209,28 +215,33 @@ $columnNameArray=['BOOK_ID','LEVEL1','LEVEL2', 'Name','PERIOD','TimeSpan:begin','TimeSpan:end','PAGE','SECTION','CONTENT', 'Description']; - $fp=fopen("./csv_files/".$fileName.".csv","w"); - fputcsv($fp,$columnNameArray); - foreach($array as $row){ - $book=array(); - $row['Description']=''; - foreach($columnNameArray as $column){ - $book[$column]=$row[$column]; + if( $fp=fopen("./csv_files/".$fileName.".csv","w")) { + // $fp=fopen("./csv_files/".$fileName.".csv","w"); + fputcsv($fp,$columnNameArray); + foreach($array as $row){ + $book=array(); + $row['Description']=''; + foreach($columnNameArray as $column){ + $book[$column]=$row[$column]; + } + $book['Name']="(".$row['PERIOD'].") ".$row['Name']; + $row['AUTHOR']=str_replace("(","(",$row['AUTHOR']); + $row['AUTHOR']=str_replace(")",") ",$row['AUTHOR']); + $book['Description']=$row['VOLUME']." ╱ ".$row['AUTHOR']." ╱ ".$row['EDITION']; + $book['SECTION']=''; + foreach($row['SECTION'] as $idx=>$section){ + $book['SECTION'].=$section['name']." ".$section['start_page']."-".$section['end_page']; + if($idx!=sizeof($row['SECTION'])){ + $book['SECTION'].=" ╱ "; + } + } + fputcsv($fp,$book); } - $book['Name']="(".$row['PERIOD'].") ".$row['Name']; - $row['AUTHOR']=str_replace("(","(",$row['AUTHOR']); - $row['AUTHOR']=str_replace(")",") ",$row['AUTHOR']); - $book['Description']=$row['VOLUME']." ╱ ".$row['AUTHOR']." ╱ ".$row['EDITION']; - $book['SECTION']=''; - foreach($row['SECTION'] as $idx=>$section){ - $book['SECTION'].=$section['name']." ".$section['start_page']."-".$section['end_page']; - if($idx!=sizeof($row['SECTION'])){ - $book['SECTION'].=" ╱ "; - } - } - fputcsv($fp,$book); - } - fclose($fp); + fclose($fp); + + } else { + error_log("error when opening file: "."./csv_files/".$fileName.".csv", 0); + } } ?>