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

Merge branch 'master' of https://github.com/visuddhinanda/mint

Bhikkhu-Kosalla преди 5 години
родител
ревизия
e314a7a611

+ 2 - 0
app/install/analysis.php

@@ -1,4 +1,6 @@
 <?php
+require_once "install_head.php";
+
 $filelist=array();
 $fileNums=0;
 if(($handle=fopen("filelist.csv",'r'))!==FALSE){

+ 3 - 0
app/install/combin_all_word_by_book.php

@@ -1,3 +1,6 @@
+<?php
+require_once "install_head.php";
+?>
 <!DOCTYPE html>
 <html>
 <head>

+ 3 - 0
app/install/combin_union.php

@@ -1,3 +1,6 @@
+<?php
+require_once "install_head.php";
+?>
 <!DOCTYPE html>
 <html>
 <head>

+ 4 - 1
app/install/count.php

@@ -1,4 +1,7 @@
-<!DOCTYPE html>
+<?php
+require_once "install_head.php";
+?>
+<!DOCTYPE html>
 <html>
 <head>
 </head>

+ 4 - 1
app/install/db_collact_para_bookid.php

@@ -1,4 +1,7 @@
-<!DOCTYPE html>
+<?php
+require_once "install_head.php";
+?>
+<!DOCTYPE html>
 <html>
 <head>
 </head>

+ 4 - 1
app/install/db_create.php

@@ -1,4 +1,7 @@
-<!DOCTYPE html>
+<?php
+require_once "install_head.php";
+?>
+<!DOCTYPE html>
 <html>
 <head>
 </head>

+ 3 - 0
app/install/db_insert_bold.php

@@ -1,3 +1,6 @@
+<?php
+require_once "install_head.php";
+?>
 <!DOCTYPE html>
 <html>
 <head>

+ 3 - 0
app/install/db_insert_bookword_from_csv.php

@@ -1,3 +1,6 @@
+<?php
+require_once "install_head.php";
+?>
 <!DOCTYPE html>
 <html>
 <head>

+ 4 - 1
app/install/db_insert_commantry.php

@@ -1,4 +1,7 @@
-<!DOCTYPE html>
+<?php
+require_once "install_head.php";
+?>
+<!DOCTYPE html>
 <html>
 <head>
 </head>

+ 3 - 0
app/install/db_insert_index.php

@@ -1,3 +1,6 @@
+<?php
+require_once "install_head.php";
+?>
 <!DOCTYPE html>
 <html>
 <head>

+ 2 - 2
app/install/db_insert_index_csv.php

@@ -1,7 +1,7 @@
 <?php
-include "./_pdo.php";
-include "../path.php";
 
+require_once "install_head.php";
+include "./_pdo.php";
 if (PHP_SAPI  == "cli") {
 	echo $argc;
 	if($argc>=3){

+ 1 - 1
app/install/db_insert_index_once.php

@@ -1,6 +1,6 @@
 <?php
+require_once "install_head.php";
 include "./_pdo.php";
-include "../path.php";
 
 if (PHP_SAPI  == "cli") {
 	echo $argc;

+ 4 - 1
app/install/db_insert_palitext.php

@@ -1,4 +1,7 @@
-<!DOCTYPE html>
+<?php
+require_once "install_head.php";
+?>
+<!DOCTYPE html>
 <html>
 <head>
 </head>

+ 3 - 0
app/install/db_insert_sentence.php

@@ -1,4 +1,7 @@
 <!--句子库生成-->
+<?php
+require_once "install_head.php";
+?>
 <!DOCTYPE html>
 <html>
 <head>

+ 1 - 0
app/install/db_insert_templet.php

@@ -2,6 +2,7 @@
 /*
 用拆分好的三藏数据 生成模板库
 */
+require_once "install_head.php";
 ?>
 <!DOCTYPE html>
 <html>

+ 4 - 1
app/install/db_insert_toc.php

@@ -1,4 +1,7 @@
-<!DOCTYPE html>
+<?php
+require_once "install_head.php";
+?>
+<!DOCTYPE html>
 <html>
 <head>
 </head>

+ 4 - 1
app/install/db_insert_word_from_csv.php

@@ -1,3 +1,6 @@
+<?php
+require_once "install_head.php";
+?>
 <!DOCTYPE html>
 <html>
 <head>
@@ -7,7 +10,7 @@
 <p><a href="index.php">Home</a></p>
 <?php
 include "./_pdo.php";
-include "../path.php";
+
 if(isset($_GET["from"])==false){
 ?>
 <form action="db_insert_word_from_csv.php" method="get">

+ 5 - 2
app/install/db_insert_wordindex_from_csv.php

@@ -1,3 +1,7 @@
+<?php
+require_once "install_head.php";
+include "./_pdo.php";
+?>
 <!DOCTYPE html>
 <html>
 <head>
@@ -5,8 +9,7 @@
 <body>
 <h2>Insert to Index</h2>
 <?php
-include "./_pdo.php";
-include "../path.php";
+
 if(isset($_GET["from"])==false){
     $from=0;
 }

+ 1 - 1
app/install/db_pali_text_export.php

@@ -1,5 +1,5 @@
 <?php
-require_once '../path.php';
+require_once "install_head.php";
 require_once "../public/_pdo.php";
 ?>
 <!DOCTYPE html>

+ 1 - 1
app/install/db_update_palitext.php

@@ -1,5 +1,5 @@
 <?php
-require_once '../path.php';
+require_once "install_head.php";
 require_once "../public/_pdo.php";
 ?>
 <!DOCTYPE html>

+ 1 - 8
app/install/db_update_toc.php

@@ -1,12 +1,5 @@
 <?php
-//error handler function
-function customError($errno, $errstr)
- { 
- echo "<b>Error:</b> [$errno] $errstr";
- }
-
-//set error handler
-set_error_handler("customError");
+require_once "install_head.php";
 
 require_once '../path.php';
 require_once "../public/_pdo.php";

+ 0 - 11
app/install/guid.php

@@ -1,11 +0,0 @@
-<?php
-if(isset($_GET["num"])){
-	$count=$_GET["num"];
-}
-else{
-	$count=1;
-}
-for($i=0;$i<$count;$i++){
- echo com_create_guid(). "<br>";
-}
-?>

+ 1 - 1
app/install/index.php

@@ -8,7 +8,7 @@ require_once '../path.php';
 <h2>Install wikipali suite</h2>
 <div style="margin:1em;background-color:#f1e7a4;">
 即将安装Pali Canon Database Studio 所需要的数据库。过程中有些数据需要联网获取。生成这些数据库约需要2-4小时。
-您也可以从网络下载已经生成好的数据库。
+您也可以从网络下载已经生成好的数据库。https://www.dropbox.com/s/34w2byt90ij1rlw/mint.7z?dl=0
 </div>
 <hr>
 <h2><a href="step1.php">Install Now</a></h2>

+ 38 - 0
app/install/install_head.php

@@ -0,0 +1,38 @@
+<?php
+    require_once "../path.php";
+//error handler function
+function customError($errno, $errstr)
+ { 
+ echo "<b>Error:</b> [$errno] $errstr";
+ }
+
+//set error handler
+set_error_handler("customError");
+
+    function user_db_is_exist(){
+        $PDO = new PDO("sqlite:"._FILE_DB_USERINFO_, "", "");
+        $PDO->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_WARNING);
+        $stmt = $PDO->query("SELECT count(*) as co FROM sqlite_master WHERE type=\"table\" AND name = \"user\"");
+        
+        $row = $stmt->fetch(PDO::FETCH_NUM);
+        if ($row) {
+            if($row[0]>0){
+                return true;
+            }
+            else{
+                return false;
+            }
+        } 
+        else 
+        {
+            return false;
+        }        
+    }
+
+    if(user_db_is_exist()){
+        if(!isset($_COOKIE["userid"])){
+            echo "请登陆后执行此操作";
+            exit;
+        }
+    }
+?>

+ 1 - 1
app/install/step1.php

@@ -1,5 +1,5 @@
 <?php
-require_once '../path.php';
+require_once "install_head.php";
 ?>
 <html>
 <head>

+ 1 - 1
app/install/step2.php

@@ -1,5 +1,5 @@
 <?php
-require_once '../path.php';
+require_once "install_head.php";
 ?>
 <html>
 <head>

+ 1 - 0
app/install/step3.php

@@ -1,4 +1,5 @@
 <?php
+require_once "install_head.php";
 require_once '../pcdl/html_head.php';
 ?>
 <body>

+ 1 - 1
app/install/step4.php

@@ -1,5 +1,5 @@
 <?php
-require_once '../path.php';
+require_once "install_head.php";
 ?>
 <html>
 <head>

+ 1 - 1
app/install/step5.php

@@ -1,5 +1,5 @@
 <?php
-require_once '../path.php';
+require_once "install_head.php";
 ?>
 <html>
 <head>

+ 1 - 1
app/install/xmlmaker.php

@@ -1,5 +1,5 @@
 <?php
-require_once '../path.php';
+require_once "install_head.php";
 ?>
 <!DOCTYPE html>
 <html>

+ 18 - 0
app/studio/project.php

@@ -47,6 +47,24 @@ else{
 }
 switch($op){
 	case "create":
+		//判断单词数量 太大的不能加载
+		$res=json_decode($data);
+		$res_book = $res[0]->book;
+		$paraList=$res[0]->parlist;
+		$paraList=rtrim($paraList,",");
+		$strQueryParaList=str_replace(",","','",$paraList);
+		$strQueryParaList="('".$strQueryParaList."')";
+		PDO_Connect("sqlite:"._FILE_DB_PALITEXT_);
+		$query="SELECT sum(lenght) as sum_str FROM pali_text WHERE \"book\" = ".$PDO->quote($res_book)." AND (\"paragraph\" in {$strQueryParaList} ) ";
+		$Fetch = PDO_FetchAll($query);
+		if(count($Fetch)>0){
+			if($Fetch[0]["sum_str"]>15000){
+				echo "文件过大。不能编辑。请选择小一点的章节";
+				exit;
+			}
+		}
+		//判断单词数量 结束
+
 	if(isset($_POST["format"]) && $_POST["format"]=="db"){
 		$res=json_decode($data);