Преглед на файлове

修改数据库 定义字符串 使用 path.php中的定义

visuddhinanda преди 5 години
родител
ревизия
4ff2aa0aad

+ 21 - 16
app/path.php

@@ -8,7 +8,27 @@ define("_DIR_PALICANON_PALITEXT_" , __DIR__."/../tmp/appdata/palicanon/pali_text
 define("_DIR_PALICANON_WBW_" , __DIR__."/../tmp/appdata/palicanon/wbw");
 define("_DIR_PALICANON_TRAN_" , __DIR__."/../tmp/appdata/palicanon/translate");
 
+//pali canon db file
+define("_FILE_DB_RESRES_INDEX_"  , __DIR__."/../tmp/appdata/palicanon/res.db3");
+define("_FILE_DB_PALITEXT_" , __DIR__."/../tmp/appdata/palicanon/pali_text.db3");
+define("_FILE_DB_STATISTICS_" , __DIR__."/../tmp/appdata/palicanon/word_statistics.db3");
+define("_FILE_DB_PALI_SENTENCE_" , __DIR__."/../tmp/appdata/palicanon/pali_sent.db3");
+define("_FILE_DB_INDEX_"  , __DIR__."/../tmp/appdata/palicanon/index.db3");
+define("_FILE_DB_WORD_INDEX_"  , __DIR__."/../tmp/appdata/palicanon/wordindex.db3");
+define("_FILE_DB_PALI_INDEX_"  , __DIR__."/../tmp/appdata/palicanon/paliindex.db3");
+define("_FILE_DB_BOOK_WORD_"  , __DIR__."/../tmp/appdata/palicanon/bookword.db3");
+define("_FILE_DB_BOLD_"  , __DIR__."/../tmp/appdata/palicanon/bold.db3");
+
+//语料库
+
+define("_DIR_CSV_PALI_CANON_WORD_" , __DIR__."/../paliword/book");
+define("_DIR_CSV_PALI_CANON_WORD_INDEX_" , __DIR__."/../paliword/index");
+
+define("_DIR_PALI_CSV_" , __DIR__."/../tmp/palicsv");
+define("_DIR_LOG_" , __DIR__."/../tmp/log");
+define("_DIR_TEMP_" , __DIR__."/../tmp/temp");
 
+//dictionary
 define("_DIR_DICT_" , __DIR__."/../tmp/appdata/dict");
 define("_DIR_DICT_SYSTEM_" , __DIR__."/../tmp/appdata/dict/system");
 define("_DIR_DICT_3RD_" , __DIR__."/../tmp/appdata/dict/3rd");
@@ -29,23 +49,8 @@ define("_DIR_APP_" , __DIR__."/../app");
 define("_DIR_LANGUAGE_" , __DIR__."/../app/public/lang");
 define("_DIR_BOOK_INDEX_" , __DIR__."/../app/public/book_index");
 
-//语料库
-define("_DIR_CSV_PALI_CANON_WORD_" , __DIR__."/../paliword/book");
-define("_DIR_CSV_PALI_CANON_WORD_INDEX_" , __DIR__."/../paliword/index");
 
-define("_DIR_PALI_CSV_" , __DIR__."/../tmp/palicsv");
-define("_DIR_LOG_" , __DIR__."/../tmp/log");
-define("_DIR_TEMP_" , __DIR__."/../tmp/temp");
-//pali canon db file
-define("_FILE_DB_RES_INDEX_"  , __DIR__."/../tmp/appdata/palicanon/res.db3");
-define("_FILE_DB_PALITEXT_" , __DIR__."/../tmp/appdata/palicanon/pali_text.db3");
-define("_FILE_DB_STATISTICS_" , __DIR__."/../tmp/appdata/palicanon/word_statistics.db3");
-define("_FILE_DB_PALI_SENTENCE_" , __DIR__."/../tmp/appdata/palicanon/pali_sent.db3");
-define("_FILE_DB_INDEX_"  , __DIR__."/../tmp/appdata/palicanon/index.db3");
-define("_FILE_DB_WORD_INDEX_"  , __DIR__."/../tmp/appdata/palicanon/wordindex.db3");
-define("_FILE_DB_PALI_INDEX_"  , __DIR__."/../tmp/appdata/palicanon/paliindex.db3");
-define("_FILE_DB_BOOK_WORD_"  , __DIR__."/../tmp/appdata/palicanon/bookword.db3");
-define("_FILE_DB_BOLD_"  , __DIR__."/../tmp/appdata/palicanon/bold.db3");
+
 
 /*user data*/
 define("_DIR_USER_BASE_" , __DIR__."/../tmp/user");

+ 0 - 0
app/studio/_FILE_DB_PALITEXT_


+ 6 - 6
app/studio/album.php

@@ -1,6 +1,6 @@
 <?php
 require 'checklogin.inc';
-require '../public/config.php';
+require '../path.php';
 require "../public/_pdo.php";
 require "./public.inc";
 
@@ -48,7 +48,7 @@ if(isset($_GET["type"])){
 switch($op)
 {
 	case "show_info":
-		$db_file = $dir_palicanon.'res.db3';
+		$db_file = _FILE_DB_RESRES_INDEX_;
 		PDO_Connect("sqlite:$db_file");
 		$album_id=$_GET["album_id"];
 		$query = "select * from 'album' where id='{$album_id}'";
@@ -263,7 +263,7 @@ switch($op)
 			<?php	
 	break;
 	case "new":
-		$db_file = $dir_palicanon.'res.db3';
+		$db_file = _FILE_DB_RESRES_INDEX_;
 		PDO_Connect("sqlite:$db_file");
 		$album_guid=$_GET["album_guid"];
 		$album_type=$_GET["album_type"];
@@ -274,7 +274,7 @@ switch($op)
 		$author=$_GET["author"];
 		$edition=$_GET["edition"];
 		$title=$_GET["title"];
-		$dbFileName="../appdata/palicanon/".$album_type."/p".$book."_".$album_type.".db3";
+		$dbFileName=_DIR_PALICANON_."/".$album_type."/p".$book."_".$album_type.".db3";
 		$PDO->beginTransaction();
 		$query="INSERT INTO album (id, 
 				book,
@@ -322,7 +322,7 @@ switch($op)
 	
 	break;
 	case "get":
-		$db_file = $dir_palicanon.'res.db3';
+		$db_file = _FILE_DB_RESRES_INDEX_;
 		PDO_Connect("sqlite:$db_file");	
 		$query = "select * from 'album' where book='{$book}' and type='{$type[$album_type]}' and owner='{$UID}'";
 		$Fetch = PDO_FetchAll($query);
@@ -338,7 +338,7 @@ switch($op)
 		if(isset($_GET["type"])){
 			$album_type=$_GET["type"];
 		}
-		$db_file = $dir_palicanon.'res.db3';
+		$db_file = _FILE_DB_RESRES_INDEX_;
 		PDO_Connect("sqlite:$db_file");	
 		$query = "select * from 'album' where id='{$album_id}'";
 		$Fetch = PDO_FetchAll($query);

+ 2 - 2
app/studio/get_res_json.php

@@ -44,7 +44,7 @@ function format_file_size($size){
 	return($str_size);
 }
 
-	$db_file = $dir_palicanon.'res.db3';
+	$db_file = _FILE_DB_RESRES_INDEX_;
 	PDO_Connect("sqlite:$db_file");
 
 	$res=array();
@@ -78,7 +78,7 @@ function format_file_size($size){
 	}
 	else{
 		//查书中的一个段
-		$db_file = $dir_palicanon.'res.db3';
+		$db_file = _FILE_DB_RESRES_INDEX_;
 		PDO_Connect("sqlite:$db_file");			
 		$query = "select * from 'index' where book='{$book}' and paragraph='{$paragraph}' and type < '5' ";
 		$Fetch = PDO_FetchAll($query);

+ 6 - 3
app/studio/note/note.php

@@ -1,5 +1,5 @@
 <?php
-require_once '../../public/config.php';
+require_once '../../path.php';
 require_once "../../public/_pdo.php";
 require_once "../public.inc";
 require_once "../book_list_en.inc";
@@ -52,8 +52,8 @@ while($result = $sth->fetch(PDO::FETCH_ASSOC))
 }
 $para_path=_get_para_path($bookId,$para);
 //find out translation
-$tran="";
-$db_file="../".$dir_palicanon."sentence.db3";
+
+$db_file=_FILE_DB_SENTENCE_;
 PDO_Connect("sqlite:$db_file");
 $query="select * from sentence where book='{$bookId}' and paragraph='{$para}' and begin='{$begin}' and end='{$end}' ";
 $Fetch = PDO_FetchAll($query);
@@ -61,6 +61,9 @@ $iFetch=count($Fetch);
 if($iFetch>0){
 	$tran = $Fetch[0]["text"];
 }
+else{
+	$tran="";
+}
 		
 
 $output=array("id"=>$id,"palitext"=>$palitext,"tran"=>$tran,"ref"=>$para_path);

+ 1 - 1
app/studio/pc_db_analysis.php

@@ -9,7 +9,7 @@ $countInsert=0;
 $wordlist=array();
 
 
-$db_file = "../appdata/palicanon/templet/res.db3";
+$db_file = _FILE_DB_RESRES_INDEX_;
 $bookstring="";
 	for($i=0;$i<count($boolList);$i++)
 	{

+ 5 - 6
app/studio/pc_get_book_res.php

@@ -10,7 +10,7 @@ $revision=$_GET["revision"];
 $edition=$_GET["edition"];
 $subver=$_GET["subver"];
 
-include "./config.php";
+include "../path.php";
 include "./_pdo.php";
 include "./public.inc";
 
@@ -22,7 +22,7 @@ $guid=GUIDv4();
 	switch($res_type){
 		case "wbw":
 			if($author=="templet"){
-				$db_file = "../appdata/palicanon/templet/".$currBook."_tpl.db3";
+				$db_file = _DIR_PALICANON_TEMPLET_."/".$currBook."_tpl.db3";
 			}
 			else{
 				$db_file = "../appdata/palicanon/wbw/".$currBook."_wbw.db3";
@@ -30,15 +30,14 @@ $guid=GUIDv4();
 			break;
 		case "heading":
 			if($author=="templet"){
-				//$db_file = "../appdata/palicanon/templet/toc.db3";
-				$db_file = "../appdata/palicanon/pali_text/".$currBook."_pali.db3";
+				$db_file = _FILE_DB_PALITEXT_;
 			}
 			else{
-				$db_file = "../appdata/palicanon/heading/toc.db3";
+				$db_file = _FILE_DB_PALITEXT_;
 			}
 			break;
 		case "translate":
-			$db_file = "../appdata/palicanon/translate/".$currBook."_translate.db3";
+			$db_file = _DIR_PALICANON_TRAN_."/".$currBook."_translate.db3";
 			break;
 		case "note":
 			$db_file = "../appdata/palicanon/note/".$currBook."_note.db3";

+ 5 - 5
app/studio/publish.php

@@ -1,6 +1,6 @@
 <?php
 require 'checklogin.inc';
-require '../public/config.php';
+require '../path.php';
 require "../public/_pdo.php";
 require "./public.inc";
 $type["pali"]=1;
@@ -67,7 +67,7 @@ function new_album($filename,$book,$album_id,$album_type,$album_author,$album_ti
 switch($step){
 	case 1:
 		if(isset($_GET["filename"])){
-			$db_file = $dir_palicanon.'res.db3';
+			$db_file = _FILE_DB_RESRES_INDEX_;
 			PDO_Connect("sqlite:$db_file");
 			$album_id=$_GET["id"];
 			$filename=$_GET["filename"];
@@ -103,7 +103,7 @@ switch($step){
 		}
 		break;
 	case 3://选择专辑
-		$db_file = $dir_palicanon.'res.db3';
+		$db_file = _FILE_DB_RESRES_INDEX_;
 		PDO_Connect("sqlite:$db_file");
 		$album_type=$_GET["album_type"];
 		$book=$_GET["book"];
@@ -327,7 +327,7 @@ switch($step){
 				
 				
 				//更新索引表
-				$db_file = $dir_palicanon.'res.db3';
+				$db_file = _FILE_DB_RESRES_INDEX_;
 				PDO_Connect("sqlite:$db_file");	
 				echo "开始更新索引 ",count($arrToc),"<br />";
 				//开始更新索引
@@ -582,7 +582,7 @@ switch($step){
 				
 				
 				//更新索引表
-				$db_file = $dir_palicanon.'res.db3';
+				$db_file = _FILE_DB_RESRES_INDEX_;
 				PDO_Connect("sqlite:$db_file");	
 				echo "开始更新索引 ",count($arrToc),"<br />";
 				//开始更新索引

+ 0 - 0
app/studio/res.db3


+ 3 - 3
app/term/note.php

@@ -24,7 +24,7 @@ $bookId=$arrSent[0];
 $para=$arrSent[1];
 $begin=$arrSent[2];
 $end=$arrSent[3];
-$db_file = _DIR_PALICANON_."/templet/p".$bookId."_tpl.db3";		
+$db_file = _DIR_PALICANON_TEMPLET_."/p".$bookId."_tpl.db3";		
 			
 PDO_Connect("sqlite:$db_file");
 $query="SELECT * FROM 'main' WHERE (\"paragraph\" = ".$PDO->quote($para)." ) ";
@@ -33,7 +33,7 @@ $sth->execute();
 $palitext="";
 while($result = $sth->fetch(PDO::FETCH_ASSOC))
 {
-	$index = str_getcsv($result["wid"],"-")[2];
+	$index =$result["wid"];
 	if($index>=$begin && $index<=$end){
 		if($result["type"]!=".ctl."){
 			$paliword=$result["word"];
@@ -64,7 +64,7 @@ try{
 	}
 }
 catch (Exception $e) {
-	$tran = "";
+	$tran = $e->getMessage();
     //echo 'Caught exception: ',  $e->getMessage(), "\n";
 }
 		

+ 22 - 43
app/wiki/wiki.php

@@ -1,14 +1,7 @@
 <?php
 require_once "../public/_pdo.php";
 require_once "../path.php";
-/*
-if(isset($_GET["word"])){
-	if(empty($_GET["word"])){
-		return;
-	}
-	$word=mb_strtolower($_GET["word"],'UTF-8');
-}
-*/
+
 if(isset($_GET["id"])){
 	$_get_id=$_GET["id"];
 }
@@ -23,25 +16,20 @@ else{
 }
 ?>
 
-<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
-<html>
-<head>
-	<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/>
-	<meta name="viewport" content="width=device-width, initial-scale=1.0">
-	<link type="text/css" rel="stylesheet" href="../studio/css/style.css"/>
-        <link type="text/css" rel="stylesheet" href="../pcdl/css/color_day.css" id="colorchange" />
-	<link type="text/css" rel="stylesheet" href="../pcdl/css/style_mobile.css" media="screen and (max-width:767px)">
-	
-	<title id="doc_title">圣典百科</title>
-	<style>
-
-	</style>
-	<script src="../public/js/jquery.js"></script>
-	<script src="../public/js/comm.js"></script>
+<?PHP
+include "../pcdl/html_head.php";
+?>
+<body style="margin: 0;padding: 0;" class="reader_body" onload="<?php
+if(isset($_get_id)){
+echo "wiki_load_id('{$_get_id}')";
+}
+else if(isset($_get_word)){
+echo "wiki_load_word('{$_get_word}')";
+}
+?>">
 	<script src="../term/term.js"></script>
 	<script src="../term/note.js"></script>
 	<script src="wiki.js"></script>
-	
 	<style>
 	.term_link,.term_link_new{
 		color: blue;
@@ -150,14 +138,6 @@ else{
 }
 
 	</style>
-<body style="margin: 0;padding: 0;" class="reader_body" onload="<?php
-if(isset($_get_id)){
-echo "wiki_load_id('{$_get_id}')";
-}
-else if(isset($_get_word)){
-echo "wiki_load_word('{$_get_word}')";
-}
-?>">
 <script>
 term_word_link_fun("wiki_goto_word");
 </script>
@@ -177,29 +157,28 @@ term_word_link_fun("wiki_goto_word");
     require_once("../pcdl/head_bar.php");
 ?>
 <div id="head_bar" >
-	<div id="pali_pedia">圣典百科</div>
-
-
-	<div>
-		<span id="wiki_search" style="width:20em;">
-			<span>
-				<input id="wiki_search_input" type="input" placeholder="search" style="width:30em;" onkeyup="wiki_search_keyup(event,this)"/>
+	<div id="pali_pedia" style="display:flex;">
+		<span>圣典百科</span>
+		<span id="wiki_search" style="width:25em;">
+			<span style="display:block;">
+				<input id="wiki_search_input" type="input" placeholder="search" style="width:30em;background-color: var(--btn-color);"  onkeyup="wiki_search_keyup(event,this)"/>
 			</span>
 			<span id="search_result">
 			</span>
 		</span>	
+	</div>
+
+	<div>
+
 		<span>
 			<a href="#">[设置]</a>
 			<a href="#">[建立词条]</a>
 			<a href="#">[帮助]</a>
-			<a href="#">[当前用户]</a>
 		</span>
-
-	
 	</div>
 </div>
 
-<div id="wiki_contents">
+<div id="wiki_contents" style="padding: 0 1em;">
 loading...
 </div>