Browse Source

Merge branch 'master' of https://github.com/iapt-platform/mint

bhikkhu-kosalla-china 4 years ago
parent
commit
2d885e6dc7

+ 0 - 1
SUMMARY.md

@@ -1 +0,0 @@
-# [wikipali 文档](mermaid/todo.md) 

+ 7 - 1
app/fts/sql.php

@@ -8,6 +8,12 @@ require_once __DIR__."/../config.php";
  *
  */
 
+set_exception_handler(function($e){
+	fwrite(STDERR,"error-msg:".$e->getMessage().PHP_EOL);
+	fwrite(STDERR,"error-file:".$e->getFile().PHP_EOL);
+	fwrite(STDERR,"error-line:".$e->getLine().PHP_EOL);
+	exit;
+});
 
 function is_pali_word ($str) {
   $pali_word_exp = "/^[āīūṅñṭḍṇḷṃṁŋĀĪŪṄÑṬḌṆḶṂṀŊabcdefghijklmnoprstuvyABCDEFGHIJKLMNOPRSTUVY-]+$/";
@@ -76,7 +82,7 @@ function count_bld ($bld_array) {
 
 $dns = _DB_ENGIN_.":host="._DB_HOST_.";port="._DB_PORT_.";dbname="._DB_NAME_.";user="._DB_USERNAME_.";password="._DB_PASSWORD_.";";
 $dbh_fts = new PDO($dns, _DB_USERNAME_, _DB_PASSWORD_, array(PDO::ATTR_PERSISTENT => true));
-$dbh_fts->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_WARNING);
+$dbh_fts->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
 
 // 查找 tmp/palicsv/ 目录下的语料数据
 $palicsv_path = __DIR__.'/../../tmp/palicsv/';

+ 11 - 8
app/install/db_insert_templet_cli.php

@@ -5,6 +5,12 @@
 require_once __DIR__."/../config.php";
 require_once __DIR__.'/../public/_pdo.php';
 
+set_exception_handler(function($e){
+	fwrite(STDERR,"error-msg:".$e->getMessage().PHP_EOL);
+	fwrite(STDERR,"error-file:".$e->getFile().PHP_EOL);
+	fwrite(STDERR,"error-line:".$e->getLine().PHP_EOL);
+	exit;
+});
 
 echo "Insert templet to DB".PHP_EOL;
 
@@ -86,12 +92,8 @@ for ($from=$_from; $from <=$_to ; $from++) {
 	#删除目标数据库中数据
 	$query = "DELETE FROM "._TABLE_." WHERE book = ?";
 	$stmt = $dbh->prepare($query);
-	try{
-		$stmt->execute(array($from));
-	}catch(PDOException $e){
-		fwrite(STDERR,$e->getMessage());
-		continue;
-	}
+	$stmt->execute(array($from));
+
 
 	echo "delete ".PHP_EOL;
 
@@ -126,8 +128,9 @@ for ($from=$_from; $from <=$_to ; $from++) {
 						try{
 							$stmt->execute($params);
 						}catch(PDOException $e){
-							fwrite(STDERR,$e->getMessage());
-							fwrite(STDERR,implode(",",$params));
+							fwrite(STDERR,$e->getMessage().PHP_EOL);
+							fwrite(STDERR,implode(",",$params).PHP_EOL);
+							fwrite(STDERR,$e->getLine().PHP_EOL);
 							break;
 						}
 				}

+ 2 - 2
app/pcdl/head_bar.php

@@ -513,8 +513,8 @@
 				</svg>
 			</a>
 		</button>
-		<?php include "../ucenter/user.php"; ?>
-		<?php include "../lang/lang.php"; ?>
+		<?php include __DIR__."/../ucenter/user.php"; ?>
+		<?php include __DIR__."/../lang/lang.php"; ?>
 	</div>
 
 	<label for="nav-toggle" class="nav-toggle-label">

+ 3 - 3
app/pcdl/html_head.php

@@ -1,6 +1,6 @@
 <?php
-require_once '../config.php';
-require_once '../public/load_lang.php';
+require_once __DIR__.'/../config.php';
+require_once __DIR__.'/../public/load_lang.php';
 
 if (isset($_GET["language"])) {
 	$currLanguage = $_GET["language"];
@@ -134,7 +134,7 @@ if (isset($_GET["language"])) {
 	<script src="../public/charcode/converter_tai_tham.js"></script>
 	<script src="../public/charcode/converter_thai.js"></script>
 	<script>
-		<?php require_once '../public/load_lang_js.php'; ?>
+		<?php require_once __DIR__.'/../public/load_lang_js.php'; ?>
 	</script>
 
 	<script src="../../node_modules/diff/dist/diff.js"></script>

+ 1 - 1
app/public/config.php

@@ -12,7 +12,7 @@ $dir_dict_system="../../appdata/dict/system/";
 $dir_dict_3rd="../../appdata/dict/3rd/";
 $dir_dict_term="../../appdata/dict/dhammaterm/";
 $dir_language = "language/";
-$_dir_lang="../public/lang/";
+$_dir_lang=__DIR__."/../public/lang/";
 $_dir_book_index="../public/book_index/";
 $dir_palicanon="../../appdata/palicanon/";
 $dir_palitext="../../appdata/palicanon/pali_text/";

+ 1 - 1
app/public/load_lang_js.php

@@ -1,5 +1,5 @@
 	<?php
-	require_once '../public/config.php';
+	require_once __DIR__.'/../public/config.php';
 	/*
 	加载js 语言包
 	范例

+ 7 - 5
app/search/paliword_sc.php

@@ -45,17 +45,19 @@ if (count($arrWordList) > 1) {
 	# 查询多个词
 	$out_data = array();
     
+	/*
     PDO_Connect(_FILE_DB_PALITEXT_);
     # 首先精确匹配
     $words = implode(" ", $arrWordList);
     $query = "SELECT book,paragraph, text as content FROM "._TABLE_PALI_TEXT_." WHERE text like ?  LIMIT ? OFFSET ?";
     $Fetch1 = PDO_FetchAll($query, array("%{$words}%", $_pagesize, $_page * $_pagesize));
-    
+    */
+
+	
+	#postgresql full text search
 
-	/*
-	postgresql full text search
     $dns = _DB_ENGIN_.":host="._DB_HOST_.";port="._DB_PORT_.";dbname="._DB_NAME_.";user="._DB_USERNAME_.";password="._DB_PASSWORD_.";";
-    PDO_Connect(_FILE_DB_PALITEXT_,_DB_USERNAME_,_DB_PASSWORD_);
+    PDO_Connect($dns,_DB_USERNAME_,_DB_PASSWORD_);
 
     $query = "SELECT
     ts_rank('{0.1, 0.2, 0.4, 1}',
@@ -79,7 +81,7 @@ if (count($arrWordList) > 1) {
     ORDER BY rank DESC
     LIMIT 40;";
     $Fetch1 = PDO_FetchAll($query, array($word, $word, $word, $word, $word));
-	*/    
+	
     foreach ($Fetch1 as $key => $value) {
         # code...
         $newRecode["title"] = $_dbPaliText->getTitle($value["book"], $value["paragraph"]);

+ 7 - 6
app/studio/pc_get_word_num.php

@@ -10,15 +10,16 @@ $get_par_end = (int)$_GET["end"];
 
 //open database
 PDO_Connect(_FILE_DB_PALICANON_TEMPLET_);
-if ($get_par_end == -1 || ($get_par_end - $get_par_begin) > 500) {
+if ($get_par_end == -1 || ($get_par_end - $get_par_begin) > 50000) {
     echo "0,0,0,0";
     exit;
-} else {
-    $query1 = "SELECT count(*) FROM "._TABLE_PALICANON_TEMPLET_." WHERE paragraph BETWEEN $get_par_begin AND $get_par_end";
-    $query2 = "SELECT count(*) FROM (SELECT count() FROM "._TABLE_PALICANON_TEMPLET_." WHERE (paragraph BETWEEN $get_par_begin AND $get_par_end ) group by real ) T";
+} else 
+{
+    $query1 = "SELECT count(*) FROM "._TABLE_PALICANON_TEMPLET_." WHERE book = $get_book and  paragraph BETWEEN $get_par_begin AND $get_par_end";
+    $query2 = "SELECT count(*) FROM (SELECT count(*),real FROM "._TABLE_PALICANON_TEMPLET_." WHERE book = $get_book and (paragraph BETWEEN $get_par_begin AND $get_par_end ) group by real ) T";
 
-    $query3 = "SELECT sum(length(real)) FROM "._TABLE_PALICANON_TEMPLET_." WHERE paragraph BETWEEN $get_par_begin AND $get_par_end";
-    $query4 = "SELECT sum(length(real)) FROM (SELECT count(),real FROM "._TABLE_PALICANON_TEMPLET_." WHERE (paragraph BETWEEN $get_par_begin AND $get_par_end ) group by real ) T";
+    $query3 = "SELECT sum(length(real)) FROM "._TABLE_PALICANON_TEMPLET_." WHERE book = $get_book and paragraph BETWEEN $get_par_begin AND $get_par_end";
+    $query4 = "SELECT sum(length(real)) FROM (SELECT count(*),real FROM "._TABLE_PALICANON_TEMPLET_." WHERE book = $get_book and (paragraph BETWEEN $get_par_begin AND $get_par_end ) group by real ) T";
 
     $allword = PDO_FetchOne($query1);
     $allword_token = PDO_FetchOne($query2);

+ 0 - 20
book.json

@@ -1,20 +0,0 @@
-{
-	"title": "wikipali手册",
-	"description": "wikipali手册",
-	"structure": {
-		"glossory": "glossory.md",
-		"langs": "langs.md"
-	},
-	"introduction": {
-		"path": "readme.md",
-		"title": "wikipali手册"
-	},
-	"styles": {
-		"website": "styles/website.css",
-		"ebook": "styles/ebook.css",
-		"pdf": "styles/pdf.css",
-		"mobi": "styles/mobi.css",
-		"epub": "styles/epub.css"
-	},
-	"language": "zh-hans"
-}

+ 0 - 4
change-log.md

@@ -1,4 +0,0 @@
-# 更改日志
-
-## 2021-12-10 
-- 合并path.php config.php 内容到config.php

+ 0 - 2
langs.md

@@ -1,2 +0,0 @@
--   [English](en/)
--   [中文](zh/)

+ 1 - 0
package.json

@@ -13,6 +13,7 @@
 		"jquery.fancytree": "^2.38.0",
 		"marked": "^2.1.3",
 		"mermaid": "^8.12.0",
+		"moment": "^2.29.1",
 		"tributejs": "^5.1.3",
 		"vue": "^3.2.8"
 	}