Browse Source

Merge pull request #293 from visuddhinanda:master

Merge branch 'master' of https://github.com/visuddhinanda/mint
Bhikkhu-Kosalla 5 years ago
parent
commit
44f0888ac5
50 changed files with 2020 additions and 1704 deletions
  1. 1 1
      app/admin/db_update_cs6_para.php
  2. 4 4
      app/admin/setting.php
  3. 2 1
      app/article/my_article_post.php
  4. 3 1
      app/article/my_article_put.php
  5. 1 1
      app/article/my_collect_post.php
  6. 1 1
      app/article/my_collect_put.php
  7. 106 111
      app/course/course.js
  8. 162 114
      app/course/course.php
  9. 3 4
      app/course/course_get.php
  10. 2 2
      app/course/course_list.php
  11. 244 95
      app/course/lesson.js
  12. 7 62
      app/course/lesson.php
  13. 16 4
      app/course/lesson_get.php
  14. 2 2
      app/course/lesson_list.php
  15. 1 1
      app/course/list_new.php
  16. 2 2
      app/course/my_course_edit.php
  17. 2 2
      app/course/my_course_list.php
  18. 20 26
      app/course/my_lesson_edit.php
  19. 4 4
      app/course/my_lesson_list.php
  20. 2 2
      app/course/my_lesson_new.php
  21. 2 2
      app/course/my_lesson_update.php
  22. 93 0
      app/course/style.css
  23. 2 2
      app/course/teacher_list.php
  24. 13 21
      app/dict/dict_lookup.php
  25. 1 1
      app/dict/split.php
  26. 11 18
      app/dict_builder/dict_find3.php
  27. 4 4
      app/dict_builder/get_one_word.php
  28. 1 1
      app/dict_builder/index - 副本.php
  29. 5 5
      app/dict_builder/index.php
  30. 4 4
      app/doc/coop.php
  31. 6 6
      app/doc/coopfilelist.php
  32. 2 2
      app/doc/docinfo.php
  33. 2 2
      app/doc/edit_wbw.php
  34. 14 0
      app/nissaya/get.php
  35. 29 2
      app/nissaya/index.php
  36. 4 18
      app/nissaya/nissaya.js
  37. 1 0
      app/path.php
  38. 16 0
      app/public/php/define.php
  39. 1 0
      app/reader/reader.js
  40. 455 475
      app/studio/js/common.js
  41. 525 535
      app/studio/js/data.js
  42. 2 3
      app/studio/js/editor.js
  43. 13 47
      app/studio/plugin/system_export/module_function.js
  44. 13 3
      app/term/note.js
  45. 20 1
      app/ucenter/active.php
  46. 67 0
      app/ucenter/active_list.php
  47. 2 3
      app/usent/sent_post.php
  48. 42 38
      app/usent/update.php
  49. 46 49
      app/uwbw/update.js
  50. 39 22
      app/uwbw/update.php

+ 1 - 1
app/admin/db_update_cs6_para.php

@@ -5,7 +5,7 @@ require_once "../path.php";
 	$db_file = _FILE_DB_PALITEXT_;
 	PDO_Connect("sqlite:$db_file");
 
-	$query = "select * from books where 1";
+	$query = "SELECT * from books where 1";
 	$books = PDO_FetchAll($query);
 
 

+ 4 - 4
app/admin/setting.php

@@ -86,7 +86,7 @@ $album_power["2"]="编辑";
 	switch($currSettingItem){
 		case "account":
 			PDO_Connect("sqlite:"._FILE_DB_USERINFO_);
-			$query = "select * from 'user' where 1 limit 0,1000";
+			$query = "SELECT * from 'user' where 1 limit 0,1000";
 			$user_info = PDO_FetchAll($query);
 			echo "<table>";
 			echo "<tr><th>id</th><th>user name</th><th>nick name</th></tr>";
@@ -106,7 +106,7 @@ $album_power["2"]="编辑";
 			PDO_Connect("sqlite:$db_file");		
 			echo "<h2>Album</h2>";
 
-			$query = "select * from 'album' where 1 limit 0,1000";
+			$query = "SELECT * from 'album' where 1 limit 0,1000";
 			$Fetch = PDO_FetchAll($query);
 			?>
 			<table>
@@ -128,10 +128,10 @@ $album_power["2"]="编辑";
 			break;		
 		case "share":
 			PDO_Connect("sqlite:"._FILE_DB_FILEINDEX_);
-			$query = "select count(*) from 'fileindex' where share=1";
+			$query = "SELECT count(*) from 'fileindex' where share=1";
 			$file_count = PDO_FetchOne($query);
 			echo "共计:{$file_count} 个共享文件";
-			$query = "select * from 'fileindex' where share=1 limit 0,100";
+			$query = "SELECT * from 'fileindex' where share=1 limit 0,100";
 			$file_share = PDO_FetchAll($query);			
 			echo "<table>";
 			echo "<tr><th>id</th><th>user id</th><th>Title</th><th>Size</th><th></th></tr>";

+ 2 - 1
app/article/my_article_post.php

@@ -4,7 +4,8 @@ require_once "../public/_pdo.php";
 require_once '../public/function.php';
 require_once '../hostsetting/function.php';
 require_once "../ucenter/active.php";
-add_edit_event("article",array("id"=>$_POST["id"],"action"=>"update"));
+
+add_edit_event(_ARTICLE_EDIT_,$_POST["id"]);
 
 $respond=array("status"=>0,"message"=>"");
 

+ 3 - 1
app/article/my_article_put.php

@@ -11,7 +11,9 @@ PDO_Connect("sqlite:"._FILE_DB_USER_ARTICLE_);
 $query="INSERT INTO article ( id,  title  , subtitle  , summary , content   , tag  , owner, setting  , status  , create_time , modify_time , receive_time   )  VALUES  ( ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? ) ";
 $sth = $PDO->prepare($query);
 $uuid = UUID::v4();
-add_edit_event("article",array("id"=>$uuid,"action"=>"insert"));
+//写入日志
+add_edit_event(_ARTICLE_NEW_,$uuid);
+
 $sth->execute(array($uuid , $_POST["title"] , "" ,"", "" , "" , $_COOKIE["userid"] , "{}" , 1 , mTime() ,  mTime() , mTime() ));
 $respond=array("status"=>0,"message"=>"");
 if (!$sth || ($sth && $sth->errorCode() != 0)) {

+ 1 - 1
app/article/my_collect_post.php

@@ -5,7 +5,7 @@ require_once '../public/function.php';
 require_once '../hostsetting/function.php';
 require_once "../ucenter/active.php";
 
-add_edit_event("collect",array("id"=>$_POST["id"]));
+add_edit_event(_COLLECTION_EDIT_,$_POST["id"]);
 
 $respond=array("status"=>0,"message"=>"");
 

+ 1 - 1
app/article/my_collect_put.php

@@ -11,7 +11,7 @@ PDO_Connect("sqlite:"._FILE_DB_USER_ARTICLE_);
 $query="INSERT INTO collect ( id,  title  , subtitle  , summary , article_list   , owner, lang  , status  , create_time , modify_time , receive_time   )  VALUES  ( ? , ? , ? , ?  , ? , ? , ? , ? , ? , ? , ? ) ";
 $sth = $PDO->prepare($query);
 $uuid = UUID::v4();
-add_edit_event("collect",array("id"=>$uuid));
+add_edit_event(_COLLECTION_NEW_,$uuid);
 $sth->execute(array($uuid , $_POST["title"] , "" ,"", "[]" ,  $_COOKIE["userid"] , "" , 1 , mTime() ,  mTime() , mTime() ));
 $respond=array("status"=>0,"message"=>"");
 if (!$sth || ($sth && $sth->errorCode() != 0)) {

+ 106 - 111
app/course/course.js

@@ -1,114 +1,109 @@
 function course_load(course_id) {
-	$.get(
-		"../course/course_get.php",
-		{
-			id: course_id,
-		},
-		function (data, status) {
-			let html = "";
-			let course_info = JSON.parse(data);
-			if (course_info) {
-				//head
-				html += "<div id='course_info_head' class='course_info_block'>";
-				html += "<div id='course_info_head_1'>";
-				html += "<div id='course_info_head_face'>";
-				html += "<img src='../../tmp/images/course/" + course_info.id + ".jpg' />";
-				html += "</div>";
-				html += "<div id='course_info_head_title'>";
-				html += "<div id='course_title'>" + course_info.title + "</div>";
-				html += "<div id='course_subtitle'>" + course_info.subtitle + "</div>";
-				html += "<div id='course_button'>";
-				html += "<button>" + gLocal.gui.watch + "</button>";
-				html += "<button disabled>" + gLocal.gui.sign_up + "</button>";
-				html += "</div>";
-				html += "</div>";
-				html += "</div>";
+    $.get(
+        "../course/course_get.php", {
+            id: course_id,
+        },
+        function(data, status) {
+            let html = "";
+            let course_info = JSON.parse(data);
+            if (course_info) {
+                //head
+                html += "<div id='course_info_head' class='course_info_block'>";
+                html += "<div id='course_info_head_1'>";
+                html += "<div id='course_info_head_face'>";
+                html += "<img src='../../tmp/images/course/" + course_info.id + ".jpg' />";
+                html += "</div>";
+                html += "<div id='course_info_head_title'>";
+                html += "<div id='course_title'>" + course_info.title + "</div>";
+                html += "<div id='course_subtitle'>" + course_info.subtitle + "</div>";
+                html += "<div id='course_button'>";
+                html += "<button class='disable'>" + gLocal.gui.watch + "</button>";
+                html += "<button disabled class='disable'>" + gLocal.gui.sign_up + "</button>";
+                html += "</div>";
+                html += "</div>";
+                html += "</div>";
 
-				html += "<div id='course_info_head_2'>";
-				html += "<span><span>" + gLocal.gui.speaker + ":</span>";
-				html +=
-					"<a href='../uhome/course.php?userid=" +
-					course_info.teacher +
-					"'>" +
-					course_info.teacher_info.nickname +
-					"</a>";
-				html += "</span>";
-				//html += "<span>地区:缅甸</span>";
-				html += "</div>";
-				// end of course_info_head_2
-				html += "</div>";
-				//end of head
-				//summary
-				if (course_info.summary.length > 0) {
-					html += "<div id='course_info_summary' class='course_info_block'>";
-					html += "<h2>" + gLocal.gui.introduction + "</h2>";
-					try {
-						html += marked(course_info.summary);
-					} catch (e) {
-						html += e.message;
-					}
-					html += "</div>";
-				}
-				//end of summary
-				//attachment
-				if (course_info.attachment.length > 0) {
-					html += "<div id='course_info_attachment' class='course_info_block'>";
-					html += "<h2>" + gLocal.gui.attachment + "</h2>";
-					try {
-						html += marked(course_info.attachment);
-					} catch (e) {
-						html += e.message;
-					}
-					html += "</div>";
-				}
-				//end of attachment
-
-				$("#course_info").html(html);
-				$("img").one("error", function () {
-					$(this).attr("src", "../course/img/default.jpg");
-				});
-			}
-		}
-	);
+                html += "<div id='course_info_head_2'>";
+                html += "<span><span>" + gLocal.gui.speaker + ": </span>";
+                html +=
+                    "<a href='../uhome/course.php?userid=" +
+                    course_info.teacher +
+                    "'>" +
+                    course_info.teacher_info.nickname +
+                    "</a>";
+                html += "</span>";
+                //html += "<span>地区:缅甸</span>";
+                html += "</div>";
+                // end of course_info_head_2
+                html += "</div>";
+                //end of head
+                //summary
+                if (course_info.summary.length > 0) {
+                    html += "<div id='course_info_summary' class='course_info_block'>";
+                    html += "<h2>" + gLocal.gui.introduction + "</h2>";
+                    try {
+                        html += marked(course_info.summary);
+                    } catch (e) {
+                        html += e.message;
+                    }
+                    html += "</div>";
+                }
+                //end of summary
+                //attachment
+                if (course_info.attachment.length > 0) {
+                    html += "<div id='course_info_attachment' class='course_info_block'>";
+                    html += "<h2>" + gLocal.gui.attachment + "</h2>";
+                    try {
+                        html += marked(course_info.attachment);
+                    } catch (e) {
+                        html += e.message;
+                    }
+                    html += "</div>";
+                }
+                //end of attachment
 
-	$.get(
-		"../course/lesson_list.php",
-		{
-			id: course_id,
-		},
-		function (data, status) {
-			let arrLesson = JSON.parse(data);
-			let html = "";
-			for (const lesson of arrLesson) {
-				//计算课程是否已经开始
-				let now = new Date();
-				let class_lesson_time = "";
-				let dt = lesson["duration"] / 60;
-				if (now < lesson["date"]) {
-					class_lesson_time = "not_started";
-				} else if (now > lesson["date"] && now < lesson["date"] + dt * 1000) {
-					class_lesson_time = "in_progress";
-				} else {
-					class_lesson_time = "already_over";
-				}
+                $("#course_info").html(html);
+                $("img").one("error", function() {
+                    $(this).attr("src", "../course/img/default.jpg");
+                });
+            }
+        }
+    );
 
-				html += '<div class="lesson_card" >';
-				let d = new Date();
-				d.setTime(lesson["date"]);
-				let strData = d.toLocaleDateString();
-				let strTime = d.toLocaleTimeString();
-				html += '<div class="pd-10">';
-				html += "<div class='datatime " + class_lesson_time + "'>" + strData + " " + strTime + "</div>";
-				html +=
-					'<div class="title" ><a href="../course/lesson.php?id=' +
-					lesson["id"] +
-					'" style="color:var(--main-color);">' +
-					lesson["title"] +
-					"</a></div>";
+    $.get(
+        "../course/lesson_list.php", {
+            id: course_id,
+        },
+        function(data, status) {
+            let arrLesson = JSON.parse(data);
+            let html = "";
+            for (const lesson of arrLesson) {
+                //计算课程是否已经开始
+                let now = new Date();
+                let class_lesson_time = "";
+                let dt = lesson["duration"] / 60;
+                if (now < lesson["date"]) {
+                    class_lesson_time = "not_started";
+                } else if (now > lesson["date"] && now < lesson["date"] + dt * 1000) {
+                    class_lesson_time = "in_progress";
+                } else {
+                    class_lesson_time = "already_over";
+                }
 
-				html += "</div>";
+                html += '<div class="lesson_card" >';
+                let d = new Date();
+                d.setTime(lesson["date"]);
+                let strData = d.toLocaleDateString();
+                let strTime = d.toLocaleTimeString();
+                html += "<div class='datatime " + class_lesson_time + "'>" + strData + " " + strTime + "</div>";
+                html +=
+                    '<div class="title" ><a href="../course/lesson.php?id=' +
+                    lesson["id"] +
+                    '" style="color:var(--main-color);">' +
+                    lesson["title"] +
+                    "</a></div>";
 
-				/*
+                /*
 				let dt = lesson["duration"] / 60;
 				let sdt = "";
 				if (dt > 59) {
@@ -124,9 +119,9 @@ function course_load(course_id) {
 				html += '<div ><span class="lesson_status">' + lesson_time + "</span></div>";
 */
 
-				html += "</div>";
-			}
-			$("#lesson_list").html(html);
-		}
-	);
-}
+                html += "</div>";
+            }
+            $("#lesson_list").html(html);
+        }
+    );
+}

+ 162 - 114
app/course/course.php

@@ -2,125 +2,173 @@
 
 include "../pcdl/html_head.php";
 ?>
+
 <body>
-<script language="javascript" src="../course/course.js"></script>
+    <script language="javascript" src="../course/course.js"></script>
 
-<?php
+    <?php
     require_once("../pcdl/head_bar.php");
-?>
+    ?>
 
-<style>
-    #main_video_win iframe{
-        width:100%;
-        height:100%;
-    }
-
-    #course_frame{
-        display:flex;
-    }
-    #course_content{
-
-        margin:0;
-        padding:0;
-    }
-    #lesson_list{
-
-    }
-    #course_info_head_1{
-        display:flex;
-    }
-    #course_info_head_face{
-        width: 200px;
-        height: 200px;
-        padding: 12px;
-    }
-    #course_info_head_face img{
-        width: 100%;
-        border-radius: 12px;
-    }
-    .section_inner{
-        max-width: 960px;
-        margin: 0 auto;
-    }
-    #course_info_head_title{
-        padding: 12px;
-    }
-    #course_title{
-        font-size: 22px;
-    font-weight: 700;
-    }
-
-    #course_subtitle {
-        font-size: 13px;
-        font-weight: 600;
-        padding: 10px 0;
-    }
-    #lesson_list_shell{
-        
-    background-color: var(--drop-bg-color);
-
-    }
-    .course_info_block{
-        border-top: 1px solid var(--box-bg-color2);
-        padding: 10px 5px;
-    }
-    .course_info_block:first{
-        border-top: none;
-    }
-    .course_info_block h2{
-        font-size: 16px;
-    }
-    #lesson_list {
-        display: flex;
-        flex-wrap: wrap;
-    }
-    #lesson_list .lesson_card{
-        width:50%;
-        padding: 15px;
-    }
-    .datatime {
-    
-    display: inline;
-    
-    padding: 1px 4px;
-    }
-    .not_started{
-        background-color: orangered;
-        color: var(--bg-color);
-    }
-    .in_progress,.already_over{
-        color: var(--btn-hover-bg-color);
-    }
-    .lesson_card .title {
-        padding: 5px;
-        font-size: 17px;
-        font-weight: 600;
-    }
-    #course_info_head_2{
-        padding:10px;
-    }
-</style>
-    
-
-<?php
-//
-
-require_once "../path.php";
-require_once "../public/_pdo.php";
-require_once '../ucenter/function.php';
-require_once '../public/function.php';
+<link type="text/css" rel="stylesheet" href="./style.css" />
+    <style>
+        .disable {
+            cursor: not-allowed;
+            opacity: 0.5;
+        }
+
+        #main_video_win iframe {
+            width: 100%;
+            height: 100%;
+        }
+
+        #course_frame {
+            display: flex;
+        }
+
+        #course_content {
+            margin: 0;
+            padding: 0;
+        }
+
+        #lesson_list {}
+
+        #course_info_head_1 {
+            display: grid;
+            grid-template-columns: 200px 1fr;
+            grid-gap: 20px;
+        }
+
+        #course_info_head_face {
+            /*width: 200px;
+            height: 200px;*/
+        }
+
+        #course_info_head_face img {
+            width: 200px;
+            height: 200px;
+            border-radius: 12px;
+            object-fit: cover;
+        }
+
+        .section_inner {
+            max-width: 960px;
+            margin: 0 auto;
+        }
+
+        #course_info_head_title {
+            display: flex;
+            flex-direction: column;
+            word-wrap: break-word;
+        }
+
+        #course_title {
+            font-size: 22px;
+            font-weight: 700;
+        }
+
+        #course_subtitle {
+            font-size: 13px;
+            padding: 10px 0;
+            word-wrap: break-word;
+        }
+
+        #course_button {
+            margin-top: auto;
+        }
+
+        #lesson_list_shell {
+            padding: 1rem;
+            background-color: #f5f5f5;
+        }
+
+        .course_info_block {
+            padding: 1rem 0;
+        }
+
+        #course_info_summary {
+            border-top: 1px solid var(--border-line-color);
+            border-bottom: 1px solid var(--border-line-color);
+        }
+
+        .course_info_block h2 {
+            font-size: 16px;
+        }
+
+        #lesson_list {
+            column-count: 2;
+            position: relative;
+        }
+
+        #lesson_list .lesson_card {
+            padding: 10px 10px 10px 0;
+            -webkit-column-break-inside: avoid;
+            page-break-inside: avoid;
+            break-inside: avoid;
+        }
+
+        .datatime {
+            display: inline;
+        }
+
+        .not_started {
+            background-color: orangered;
+            color: var(--bg-color);
+        }
+
+        .in_progress,
+        .already_over {
+            color: var(--btn-hover-bg-color);
+        }
+
+        .lesson_card .title {
+            margin-top: 5px;
+            font-size: 17px;
+            font-weight: 600;
+            display: -webkit-box;
+            -webkit-box-orient: vertical;
+            overflow: hidden;
+            text-overflow: ellipsis;
+            width: 100%;
+            -webkit-line-clamp: 2;
+        }
+
+        #course_info_head_2 {
+            margin: 1rem 0;
+        }
+
+        @media screen and (max-width:800px) {
+            #lesson_list {
+                column-count: 1;
+            }
+
+            #course_info_head_1 {
+                grid-template-columns: 100px 1fr;
+                grid-gap: 10px;
+            }
+
+            #course_info_head_face img {
+                width: 100px;
+                height: 100px;
+                border-radius: 6px;
+            }
+        }
+    </style>
 
-?>
 
 
-<div id='course_content' >
-    <div id='course_info_shell'><div id='course_info' class="section_inner"></div></div>
-    <div id='lesson_list_shell'><div id='lesson_list' class="section_inner"></div></div>
-</div>
+    <div id='course_content'>
+        <div id='course_info_shell' style='padding:1rem;'>
+            <div id='course_info' class="section_inner"></div>
+        </div>
+        <div id='lesson_list_shell'>
+            <div id='lesson_list' class="section_inner"></div>
+        </div>
+    </div>
 
-<script>
-    course_load("<?php echo $_GET["id"]; ?>");
-</script>
-<?php
-include "../pcdl/html_foot.php";
-?>
+    <script>
+        course_load("<?php echo $_GET["id"]; ?>");
+    </script>
+    <?php
+    include "../pcdl/html_foot.php";
+    ?>

+ 3 - 4
app/course/course_get.php

@@ -5,11 +5,10 @@ require_once "../path.php";
 require_once "../public/_pdo.php";
 require_once "../ucenter/function.php";
 
-global $PDO;
-PDO_Connect("sqlite:"._FILE_DB_COURSE_);
-$query = "select * from course where id = '{$_GET["id"]}'   limit 0,1";
-$fCourse = PDO_FetchRow($query);
 $userinfo = new UserInfo();
+PDO_Connect("sqlite:"._FILE_DB_COURSE_);
+$query = "SELECT * from course where id = ?   limit 0,1";
+$fCourse = PDO_FetchRow($query,array($_GET["id"]));
 
 if ($fCourse) {
     # code...

+ 2 - 2
app/course/course_list.php

@@ -21,11 +21,11 @@ global $PDO;
 PDO_Connect("sqlite:"._FILE_DB_COURSE_);
 
 if(isset($_GET["teacher"])){
-    $query = "select * from course where teacher = ?  order by create_time DESC limit 0,100";
+    $query = "SELECT * from course where teacher = ?  order by create_time DESC limit 0,100";
     $Fetch = PDO_FetchAll($query,array($_GET["teacher"]));    
 }
 else{
-    $query = "select * from course where 1  order by create_time DESC limit 0,100";
+    $query = "SELECT * from course where 1  order by create_time DESC limit 0,100";
     $Fetch = PDO_FetchAll($query);
 }
 $userinfo = new UserInfo();

+ 244 - 95
app/course/lesson.js

@@ -1,101 +1,250 @@
 var renderer = new marked.Renderer();
 renderer.code = function (code, language) {
-  if (language == "mermaid") return '<pre class="mermaid">' + code + "</pre>";
-  else return "<pre><code>" + code + "</code></pre>";
+	if (language == "mermaid") return '<pre class="mermaid">' + code + "</pre>";
+	else return "<pre><code>" + code + "</code></pre>";
 };
 
 function lesson_show(id) {
-  $.get(
-    "../course/lesson_get.php",
-    {
-      id: id,
-    },
-    function (data, status) {
-      let arrLesson = JSON.parse(data);
-      let html = "";
-      for (const lesson of arrLesson) {
-        html +=
-          '<div class="card" style="display:flex;margin:1em;padding:10px;">';
-
-        html += '<div style="flex:7;">';
-        html += '<div class="pd-10">';
-        html +=
-          '<div class="title" style="padding-bottom:5px;font-size:200%;font-weight:600;">' +
-          lesson["title"] +
-          "</div>";
-        html += '<div style="">';
-        let summary = "";
-        try {
-          summary = marked(lesson["summary"], { renderer: renderer });
-        } catch { }
-        html +=
-          '<div class="summary"  style="padding-bottom:5px;">' +
-          summary +
-          "</div>";
-        let live = "";
-        try {
-          live = marked(lesson["live"], { renderer: renderer });
-        } catch { }
-        html +=
-          '<div class="summary"  style="padding-bottom:5px;">' +
-          live +
-          "</div>";
-        let replay = "";
-        try {
-          replay = marked(lesson["replay"], { renderer: renderer });
-        } catch { }
-        html +=
-          '<div class="summary"  style="padding-bottom:5px;">' +
-          replay +
-          "</div>";
-        let attachment = "";
-        try {
-          attachment = marked(lesson["attachment"], { renderer: renderer });
-        } catch { }
-        html +=
-          '<div class="summary"  style="padding-bottom:5px;">' +
-          attachment +
-          "</div>";
-        html += "</div>";
-        html += "</div>";
-        html += "</div>";
-
-        html += '<div style="flex:3;max-width:15em;">';
-        let d = new Date();
-        d.setTime(lesson["date"]);
-        let strData = d.toLocaleDateString();
-        let strTime = d.toLocaleTimeString();
-        html += "<div >" + gLocal.gui.date + ":" + strData + "</div>";
-        html += "<div >" + gLocal.gui.time + ":" + strTime + "</div>";
-        let dt = lesson["duration"] / 60;
-        let sdt = "";
-        if (dt > 59) {
-          sdt += Math.floor(dt / 60) + gLocal.gui.h;
-        }
-        let m = dt % 60;
-        if (m > 0) {
-          sdt += (dt % 60) + gLocal.gui.mins;
-        }
-        html += "<div >" + gLocal.gui.duration + ":" + sdt + "</div>";
-        let now = new Date();
-
-        let lesson_time = "";
-        if (now < lesson["date"]) {
-          lesson_time = gLocal.gui.not_started;
-        } else if (now > lesson["date"] && now < lesson["date"] + dt * 1000) {
-          lesson_time = gLocal.gui.in_progress;
-        } else {
-          lesson_time = gLocal.gui.already_over;
-        }
-        html +=
-          '<div ><span class="lesson_status">' + lesson_time + "</span></div>";
-
-        html += "</div>";
-
-        html += "</div>";
-      }
-      $("#lesson_list").html(html);
-      mermaid.initialize();
-    }
-  );
+	$.get(
+		"../course/lesson_get.php",
+		{
+			id: id,
+		},
+		function (data, status) {
+			let arrLesson = JSON.parse(data);
+			let html = "";
+			for (const lesson of arrLesson) {
+				html += '<div class="card" style="display:flex;margin:1em;padding:10px;">';
+
+				html += '<div style="flex:7;">';
+				html += '<div class="pd-10">';
+				html +=
+					'<div class="title" style="padding-bottom:5px;font-size:200%;font-weight:600;">' +
+					lesson["title"] +
+					"</div>";
+				html += '<div style="">';
+				let summary = "";
+				try {
+					summary = marked(lesson["summary"], { renderer: renderer });
+				} catch {}
+				html += '<div class="summary"  style="padding-bottom:5px;">' + summary + "</div>";
+				let live = "";
+				try {
+					live = marked(lesson["live"], { renderer: renderer });
+				} catch {}
+				html += '<div class="summary"  style="padding-bottom:5px;">' + live + "</div>";
+				let replay = "";
+				try {
+					replay = marked(lesson["replay"], { renderer: renderer });
+				} catch {}
+				html += '<div class="summary"  style="padding-bottom:5px;">' + replay + "</div>";
+				let attachment = "";
+				try {
+					attachment = marked(lesson["attachment"], { renderer: renderer });
+				} catch {}
+				html += '<div class="summary"  style="padding-bottom:5px;">' + attachment + "</div>";
+				html += "</div>";
+				html += "</div>";
+				html += "</div>";
+
+				html += '<div style="flex:3;max-width:15em;">';
+				let d = new Date();
+				d.setTime(lesson["date"]);
+				let strData = d.toLocaleDateString();
+				let strTime = d.toLocaleTimeString();
+				html += "<div >" + gLocal.gui.date + ":" + strData + "</div>";
+				html += "<div >" + gLocal.gui.time + ":" + strTime + "</div>";
+				let dt = lesson["duration"] / 60;
+				let sdt = "";
+				if (dt > 59) {
+					sdt += Math.floor(dt / 60) + gLocal.gui.h;
+				}
+				let m = dt % 60;
+				if (m > 0) {
+					sdt += (dt % 60) + gLocal.gui.mins;
+				}
+				html += "<div >" + gLocal.gui.duration + ":" + sdt + "</div>";
+				let now = new Date();
+
+				let lesson_time = "";
+				if (now < lesson["date"]) {
+					lesson_time = gLocal.gui.not_started;
+				} else if (now > lesson["date"] && now < lesson["date"] + dt * 1000) {
+					lesson_time = gLocal.gui.in_progress;
+				} else {
+					lesson_time = gLocal.gui.already_over;
+				}
+				html += '<div ><span class="lesson_status">' + lesson_time + "</span></div>";
+
+				html += "</div>";
+
+				html += "</div>";
+			}
+			$("#lesson_list").html(html);
+			mermaid.initialize();
+		}
+	);
+}
+
+function lesson_load(lesson_id) {
+	$.get(
+		"../course/lesson_get.php",
+		{
+			id: lesson_id,
+		},
+		function (data, status) {
+			let html = "";
+			let lesson_info = JSON.parse(data);
+			if (lesson_info) {
+				//head
+				html += "<div id='course_info_head' class='course_info_block'>";
+
+				html += "<div id='course_info_head_title'>";
+				html += "<div id='course_title'>" + lesson_info.title + "</div>";
+				html += "<div id='course_subtitle'>" + lesson_info.subtitle + "</div>";
+				html += "</div>";
+				html += "</div>";
+				//end of head
+
+				let d = new Date();
+				d.setTime(lesson_info.date);
+				let strData = d.toLocaleDateString();
+				let strTime = d.toLocaleTimeString();
+				let dt = lesson_info["duration"] / 60;
+				let strDuration = "";
+				if (dt > 59) {
+					strDuration += Math.floor(dt / 60) + "小时";
+				}
+				let m = dt % 60;
+				if (m > 0) {
+					strDuration += (dt % 60) + "分钟";
+				}
+
+				html += "<div id='course_info_head_2' class='course_info_block'>";
+				html += "<div class='info_item'>" + "<span>上课时间:<span>" + strData + " " + strTime + "</div>";
+				html +=
+					"<div class='info_item'>" + "<span>" + gLocal.gui.duration + ":<span>" + strDuration + "</div>";
+				html += "<div class='info_item'>" + "<span>" + gLocal.gui.speaker + ":<span>";
+				html +=
+					"<a href='../uhome/course.php?userid=" +
+					lesson_info.teacher +
+					"'>" +
+					lesson_info.teacher_info.nickname +
+					"</a>";
+				html += "</span>";
+				//html += "<span>地区:缅甸</span>";
+				html += "</div>";
+				html += "</div>";
+				// end of course_info_head_2
+
+				//live
+				if (lesson_info.live && lesson_info.live.length > 0) {
+					html += "<div id='course_info_live' class='course_info_block'>";
+					html += "<h2>" + gLocal.gui.notice_live + "</h2>";
+					try {
+						html += marked(lesson_info.live);
+					} catch (e) {
+						html += e.message;
+					}
+					html += "</div>";
+				}
+				//end of live
+
+				//replay
+				if (lesson_info.replay && lesson_info.replay.length > 0) {
+					html += "<div id='course_info_replay' class='course_info_block'>";
+					html += "<h2>" + gLocal.gui.record_replay + "</h2>";
+					try {
+						html += marked(lesson_info.replay);
+					} catch (e) {
+						html += e.message;
+					}
+					html += "</div>";
+				}
+				//end of replay
+
+				//attachment
+				if (lesson_info.attachment && lesson_info.attachment.length > 0) {
+					html += "<div id='course_info_attachment' class='course_info_block'>";
+					html += "<h2>" + gLocal.gui.attachment + "</h2>";
+					try {
+						html += "<div class='course_info_content'>";
+						html += note_init(lesson_info.attachment);
+						html += "</div>";
+					} catch (e) {
+						html += e.message;
+					}
+					html += "</div>";
+				}
+				//end of attachment
+
+				//content
+				if (lesson_info.content && lesson_info.content.length > 0) {
+					html += "<div id='course_info_content' class='course_info_block'>";
+					html += "<h2>" + gLocal.gui.detaile + "</h2>";
+					try {
+						html += marked(lesson_info.content);
+					} catch (e) {
+						html += e.message;
+					}
+					html += "</div>";
+				}
+				//end of attachment
+				$("#lesson_info").html(html);
+				note_refresh_new();
+				render_lesson_list(lesson_info.course_id, lesson_info.id);
+			}
+		}
+	);
+}
+
+function render_lesson_list(id, currLesson) {
+	$.get(
+		"../course/lesson_list.php",
+		{
+			id: id,
+		},
+		function (data, status) {
+			let arrLesson = JSON.parse(data);
+			let html = "";
+			for (const lesson of arrLesson) {
+				let currlessonStyle = "";
+				if (lesson.id == currLesson) {
+					currlessonStyle = " curr_lesson";
+				} else {
+					currlessonStyle = " not_curr_lesson";
+				}
+				//计算课程是否已经开始
+				let now = new Date();
+				let class_lesson_time = "";
+				let dt = lesson["duration"] / 60;
+				if (now < lesson["date"]) {
+					class_lesson_time = "not_started";
+				} else if (now > lesson["date"] && now < lesson["date"] + dt * 1000) {
+					class_lesson_time = "in_progress";
+				} else {
+					class_lesson_time = "already_over";
+				}
+
+				html += '<div class="lesson_card ' + currlessonStyle + '" >';
+				let d = new Date();
+				d.setTime(lesson["date"]);
+				let strData = d.toLocaleDateString();
+				let strTime = d.toLocaleTimeString();
+				html += '<div class="pd-10">';
+				html += "<div class='datatime " + class_lesson_time + "'>" + strData + " " + strTime + "</div>";
+				html +=
+					'<div class="title" ><a href="../course/lesson.php?id=' +
+					lesson["id"] +
+					'">' +
+					lesson["title"] +
+					"</a></div>";
+
+				html += "</div>";
+
+				html += "</div>";
+			}
+			$("#lesson_list").html(html);
+		}
+	);
 }

+ 7 - 62
app/course/lesson.php

@@ -10,71 +10,16 @@ include "../pcdl/html_head.php";
     require_once("../pcdl/head_bar.php");
 ?>
 
-<style>
-    #main_video_win iframe{
-        width:100%;
-        height:100%;
-    }
-</style>
-<?php
-//
-
-require_once "../path.php";
-require_once "../public/_pdo.php";
-require_once '../ucenter/function.php';
-require_once '../public/function.php';
-
-global $PDO;
-PDO_Connect("sqlite:"._FILE_DB_COURSE_);
-$query = "select * from lesson where id = '{$_GET["id"]}'   limit 0,1";
-$Fetch = PDO_FetchAll($query);
-if(count($Fetch)==0)
-{
-    echo "无法找到此课程。可能该课程已经被拥有者删除。";
-    exit;
-}
-$lesson_info = $Fetch[0];
-
-$query = "select * from course where id = '{$lesson_info["course_id"]}'   limit 0,1";
-$Fetch = PDO_FetchAll($query);
-if(count($Fetch)==0)
-{
-    echo "无法找到此课程。可能该课程已经被拥有者删除。";
-    exit;
-}
-$course_info = $Fetch[0];
-
-echo "<div id='course_head_bar' style='background-color:var(--tool-bg-color1);padding:1em 10px 10px 10px;'>";
-echo "<div class='index_inner '>";
-echo "<div style='font-size:140%'>";
-echo "<a href='../uhome/course.php?userid={$course_info["teacher"]}'>";
-echo ucenter_getA($course_info["teacher"]);
-echo "</a>";
-echo " > ";
-echo "<a href='../course/course.php?id={$course_info["id"]}'>";
-echo $course_info["title"];
-echo "</a>";
-echo " > ";
-echo $lesson_info["title"];
-echo "</div>";
-echo '<div class="summary"  style="padding-bottom:5px;">'.$course_info["subtitle"].'</div>';
-echo '<div class="summary"  style=""><button>关注</button><button>报名</button><button>分享</button></div>';
-echo "</div>";
-echo '</div>';
-
-echo "<div  class='index_inner'>";
+<link type="text/css" rel="stylesheet" href="./style.css" />
 
-echo "<div id='lesson_list'>";
-
-echo "</div>";
-
-?>
+<div id='course_content' >
+    <div id='course_info_shell'><div id='course_info' class="section_inner"></div></div>
+    <div id='lesson_info_shell'><div id='lesson_info' class="section_inner"></div></div>
+    <div id='lesson_list_shell'><div id='lesson_list' class="section_inner lesson"></div></div>
 </div>
-<script>
-
-$("#main_video_win").height($("#main_video_win").width()*9/16);
-lesson_show("<?php echo $_GET["id"]; ?>");
 
+<script>
+lesson_load("<?php echo $_GET["id"]; ?>");
 </script>
 <?php
 include "../pcdl/html_foot.php";

+ 16 - 4
app/course/lesson_get.php

@@ -3,11 +3,23 @@
 
 require_once "../path.php";
 require_once "../public/_pdo.php";
+require_once "../ucenter/function.php";
+
+$userinfo = new UserInfo();
 
-global $PDO;
 PDO_Connect("sqlite:"._FILE_DB_COURSE_);
-$query = "select * from lesson where id = '{$_GET["id"]}'   limit 0,1";
-$fAllLesson = PDO_FetchAll($query);
-echo json_encode($fAllLesson, JSON_UNESCAPED_UNICODE);
+$query = "SELECT * from lesson where id = ?   limit 0,1";
+$fLesson = PDO_FetchRow($query,array($_GET["id"]));
+
+if ($fLesson) {
+    # code...
+    $user = $userinfo->getName($fLesson["teacher"]);
+	$fLesson["teacher_info"] = $user;
+	echo json_encode($fLesson, JSON_UNESCAPED_UNICODE);
+}
+else{
+	echo json_encode(array(), JSON_UNESCAPED_UNICODE);
+}
+
 
 ?>

+ 2 - 2
app/course/lesson_list.php

@@ -6,8 +6,8 @@ require_once "../public/_pdo.php";
 
 global $PDO;
 PDO_Connect("sqlite:"._FILE_DB_COURSE_);
-$query = "select * from lesson where course_id = '{$_GET["id"]}' order by date DESC    limit 0,200";
-$fAllLesson = PDO_FetchAll($query);
+$query = "SELECT * from lesson where course_id = ? order by date DESC    limit 0,200";
+$fAllLesson = PDO_FetchAll($query,array($_GET["id"]));
 echo json_encode($fAllLesson, JSON_UNESCAPED_UNICODE);
 
 ?>

+ 1 - 1
app/course/list_new.php

@@ -8,7 +8,7 @@ require_once '../ucenter/function.php';
 
 global $PDO;
 PDO_Connect("sqlite:" . _FILE_DB_COURSE_);
-$query = "select * from course where 1  order by modify_time DESC limit 0,4";
+$query = "SELECT * from course where 1  order by modify_time DESC limit 0,4";
 $Fetch = PDO_FetchAll($query);
 
 foreach ($Fetch as $row) {

+ 2 - 2
app/course/my_course_edit.php

@@ -44,8 +44,8 @@ global $PDO;
 PDO_Connect("sqlite:"._FILE_DB_COURSE_);
 
 
-$query = "select * from course where id = '{$_GET["course"]}'   limit 0,1";
-$Fetch = PDO_FetchAll($query);
+$query = "SELECT * from course where id = ?   limit 0,1";
+$Fetch = PDO_FetchAll($query,array($_GET["course"]));
 if(count($Fetch)==0)
 {
     echo "无法找到此课程。可能该课程已经被拥有者删除。";

+ 2 - 2
app/course/my_course_list.php

@@ -38,8 +38,8 @@ require_once '../ucenter/function.php';
 
 global $PDO;
 PDO_Connect("sqlite:"._FILE_DB_COURSE_);
-$query = "select * from course where creator = '{$_COOKIE["userid"]}'  order by modify_time DESC limit 0,100";
-$Fetch = PDO_FetchAll($query);
+$query = "SELECT * from course where creator = ?  order by modify_time DESC limit 0,100";
+$Fetch = PDO_FetchAll($query,array($_COOKIE["userid"]));
 
 foreach($Fetch as $row){
     echo '<div class="file_list_row">';

+ 20 - 26
app/course/my_lesson_edit.php

@@ -45,8 +45,8 @@ require_once '../media/function.php';
 global $PDO;
 PDO_Connect("sqlite:"._FILE_DB_COURSE_);
 
-$query = "select * from lesson where id = '{$_GET["lesson"]}'   limit 0,1";
-$Fetch = PDO_FetchAll($query);
+$query = "SELECT * from lesson where id = ?  limit 0,1";
+$Fetch = PDO_FetchAll($query,array($_GET["lesson"]));
 if(count($Fetch)==0)
 {
     echo "无法找到此课程。可能该课程已经被拥有者删除。";
@@ -54,8 +54,8 @@ if(count($Fetch)==0)
 }
 $lesson_info = $Fetch[0];
 
-$query = "select * from course where id = '{$lesson_info["course_id"]}'   limit 0,1";
-$Fetch = PDO_FetchAll($query);
+$query = "SELECT * from course where id = ?   limit 0,1";
+$Fetch = PDO_FetchAll($query,array($lesson_info["course_id"]));
 if(count($Fetch)==0)
 {
     echo "无法找到此课程。可能该课程已经被拥有者删除。";
@@ -72,24 +72,6 @@ echo '</div>';
 echo '<div></div>';
 echo '</div>';
 
-/*
-$coverList = array();
-
-$coverList[] = $lesson_info["cover"];
-
-$covers = media_get($coverList);
-foreach ($covers as $value) {
-    $cover["{$value["id"]}"] = $value["link"];
-}
-
-    $coverlink = $cover["{$lesson_info["cover"]}"];
-    if(substr($coverlink,0,6)=="media:"){
-        $cover_html = '<div style="width: 20em;"><img src="'._DIR_USER_IMG_LINK_.'/'.substr($coverlink,6).'" width="100%" height="auto"></div>';
-    }
-    else{
-        $cover_html =  '<div style="width: 20em;"><img src="'.$coverlink.'" width="50" height="50"></div>';
-    }
-*/
 echo '<div style="display:flex;">';
 
 echo '<div style="flex:8;padding:0 0.8em;">';
@@ -113,6 +95,14 @@ echo '<div id="userfilelist">';
     echo '<div style="flex:8;"><input type="input" name = "subtitle" value="'.$lesson_info["subtitle"].'" /></div>';
     echo '</div>';
 
+    
+    # 主讲人
+    echo '<div style="display:flex;">';
+    echo '<div style="flex:2;">'.$_local->gui->speaker.'</div>';
+    echo '<div id="teacher_id" style="flex:8;"></div>';
+    echo '<input id="form_teacher" type="hidden" name="teacher" value="'.$lesson_info["teacher"].'" />';
+    echo '</div>'; 
+
     echo '<div style="display:flex;">';
     echo '<div style="flex:2;">'.$_local->gui->introduction.'</div>';
     echo '<div style="flex:8;"><textarea name="summary" style="height:6em;">'.$lesson_info["summary"].'</textarea></div>';
@@ -137,20 +127,24 @@ echo '<div id="userfilelist">';
     echo '</div>';
     echo '</div>';
 
+    #直播
     echo '<div style="display:flex;">';
     echo '<div style="flex:2;">'.$_local->gui->notice_live.'</div>';
     echo '<div style="flex:8;"><textarea name="live" style="height:6em;">'.$lesson_info["live"].'</textarea></div>';
     echo '</div>';
+
+    #录播
     echo '<div style="display:flex;">';
     echo '<div style="flex:2;">'.$_local->gui->record_replay.'</div>';
     echo '<div style="flex:8;"><textarea name="replay" style="height:6em;">'.$lesson_info["replay"].'</textarea></div>';
     echo '</div>';
 
+
+    #附件
     echo '<div style="display:flex;">';
-    echo '<div style="flex:2;">'.$_local->gui->speaker.'</div>';
-    echo '<div id="teacher_id" style="flex:8;"></div>';
-    echo '<input id="form_teacher" type="hidden" name="teacher" value="'.$lesson_info["teacher"].'" />';
-    echo '</div>'; 
+    echo '<div style="flex:2;">'.$_local->gui->attachment.'</div>';
+    echo '<div style="flex:8;"><textarea name="attachment" style="height:10em;">'.$lesson_info["attachment"].'</textarea></div>';
+    echo '</div>';
 
 echo '</div>';
 ?>

+ 4 - 4
app/course/my_lesson_list.php

@@ -43,8 +43,8 @@ require_once '../ucenter/function.php';
 
 global $PDO;
 PDO_Connect("sqlite:"._FILE_DB_COURSE_);
-$query = "select * from course where id = '{$_GET["course"]}'   limit 0,1";
-$Fetch = PDO_FetchAll($query);
+$query = "SELECT * from course where id = ?   limit 0,1";
+$Fetch = PDO_FetchAll($query,array($_GET["course"]));
 if(count($Fetch)==0)
 {
     echo "无法找到此课程。可能该课程已经被拥有者删除。";
@@ -113,8 +113,8 @@ echo '</div>';
 <div style="flex:8;padding:0 0.8em;">
 
 <?php
-$query = "select * from lesson where course_id = '{$_GET["course"]}'   limit 0,100";
-$fAllLesson = PDO_FetchAll($query);
+$query = "SELECT * from lesson where course_id = ?   limit 0,100";
+$fAllLesson = PDO_FetchAll($query,array($_GET["course"]));
 
 
 echo '<div id="userfilelist">';

+ 2 - 2
app/course/my_lesson_new.php

@@ -36,8 +36,8 @@ require_once '../ucenter/function.php';
 
 global $PDO;
 PDO_Connect("sqlite:"._FILE_DB_COURSE_);
-$query = "select * from course where id = '{$_GET["course"]}'   limit 0,1";
-$Fetch = PDO_FetchAll($query);
+$query = "SELECT * from course where id = ?   limit 0,1";
+$Fetch = PDO_FetchAll($query,array($_GET["course"]));
 if(count($Fetch)==0)
 {
     echo "无法找到此课程。可能该课程已经被拥有者删除。";

+ 2 - 2
app/course/my_lesson_update.php

@@ -11,7 +11,7 @@ $course_id = PDO_FetchOne($query,array($_POST["lesson"]));
 $query="UPDATE course SET  receive_time= ?  , modify_time= ?   where  id = ?  ";
 PDO_Execute($query,array(mTime(),mTime(),$course_id));
 
-$query="UPDATE lesson SET title = ? , subtitle = ? , date = ? , duration = ? , live = ? , replay = ? , summary = ? , teacher = ?  , receive_time= ?  , modify_time= ?   where  id = ?  ";
+$query="UPDATE lesson SET title = ? , subtitle = ? , date = ? , duration = ? , live = ? , replay = ? , summary = ? , teacher = ?  , attachment = ?, receive_time= ?  , modify_time= ?   where  id = ?  ";
 $sth = $PDO->prepare($query);
 
 $data = strtotime($_POST["lesson_date"]);
@@ -20,7 +20,7 @@ $timezone = $_POST["lesson_timezone"];
 $datatime = ($data+$time+$timezone*60)*1000;
 $duration = strtotime($_POST["duration"]) - strtotime("today");
 
-$sth->execute(array($_POST["title"] , $_POST["subtitle"] ,$datatime, $duration , $_POST["live"] , $_POST["replay"] , $_POST["summary"] ,  $_POST["teacher"] ,  mTime() , mTime() , $_POST["lesson"]));
+$sth->execute(array($_POST["title"] , $_POST["subtitle"] ,$datatime, $duration , $_POST["live"] , $_POST["replay"] , $_POST["summary"] ,  $_POST["teacher"] , $_POST["attachment"] ,  mTime() , mTime() , $_POST["lesson"]));
 $respond=array("status"=>0,"message"=>"");
 if (!$sth || ($sth && $sth->errorCode() != 0)) {
 	$error = PDO_ErrorInfo();

+ 93 - 0
app/course/style.css

@@ -0,0 +1,93 @@
+#course_frame {
+	display: flex;
+}
+#course_content {
+	margin: 0;
+	padding: 0;
+}
+#lesson_list {
+}
+#course_info_head_1 {
+	display: flex;
+}
+#course_info_head_face {
+	width: 200px;
+	height: 200px;
+	padding: 12px;
+}
+#course_info_head_face img {
+	width: 100%;
+	border-radius: 12px;
+}
+.section_inner {
+	max-width: 960px;
+	margin: 0 auto;
+}
+#course_info_head_title {
+	padding: 12px;
+}
+#course_title {
+	font-size: 22px;
+	font-weight: 700;
+}
+
+#course_subtitle {
+	font-size: 13px;
+	font-weight: 600;
+	padding: 10px 0;
+}
+#lesson_list_shell {
+	background-color: var(--drop-bg-color);
+}
+.course_info_block {
+	border-top: 1px solid var(--box-bg-color2);
+	padding: 10px 5px;
+}
+.course_info_block:first {
+	border-top: none;
+}
+.course_info_block h2 {
+	font-size: 16px;
+}
+#lesson_list {
+	display: flex;
+	flex-wrap: wrap;
+}
+#lesson_list .lesson_card {
+	width: 50%;
+	padding: 15px;
+}
+.datatime {
+	display: inline;
+
+	padding: 1px 4px;
+}
+.not_started {
+	background-color: orangered;
+	color: var(--bg-color);
+}
+.in_progress,
+.already_over {
+	color: var(--btn-hover-bg-color);
+}
+.lesson_card .title {
+	padding: 5px;
+	font-size: 17px;
+	font-weight: 600;
+}
+.curr_lesson {
+	border-left: 2px solid var(--tool-bt-bg-color1);
+}
+.curr_lesson a {
+	color: var(--main-color);
+}
+.not_curr_lesson {
+	border-left: 2px solid var(--border-line-color);
+	color: gray;
+}
+.not_curr_lesson a {
+	color: gray;
+}
+#course_info_head_2 {
+	padding: 10px;
+}

+ 2 - 2
app/course/teacher_list.php

@@ -8,7 +8,7 @@ require_once '../ucenter/function.php';
 
 global $PDO;
 PDO_Connect("sqlite:" . _FILE_DB_COURSE_);
-$query = "select teacher,count(*) as co from course where 1 group by teacher order by co DESC limit 0,4";
+$query = "SELECT teacher,count(*) as co from course where 1 group by teacher order by co DESC limit 0,4";
 $Fetch = PDO_FetchAll($query);
 
 foreach ($Fetch as $value) {
@@ -18,7 +18,7 @@ foreach ($Fetch as $value) {
     echo '<div class="title"><a href="../uhome/course.php?userid=' . $value['teacher'] . '">' . ucenter_getA($value['teacher']) . '</a></div>';
     echo '<div class="teacher_intro">';
     PDO_Connect("sqlite:" . _FILE_DB_USERINFO_);
-    $query = "select bio from profile where user_id = ? limit 0,10";
+    $query = "SELECT bio from profile where user_id = ? limit 0,10";
     $Fetch = PDO_FetchAll($query,array($value['teacher']));
     if($Fetch){
         echo $Fetch[0]["bio"];

+ 13 - 21
app/dict/dict_lookup.php

@@ -24,16 +24,8 @@ $right_word_list="";
 global $PDO;
 function isExsit($word){
 global $PDO;
-		$query = "select count(*) as co from dict where \"word\" = ".$PDO->quote($word);
-		$row=PDO_FetchOne($query);
-		/*
-		$Fetch = PDO_FetchAll($query);
-		$iFetch=count($Fetch);
-		$count_return+=$iFetch;
-		if($iFetch>0){
-		
-		}
-		*/
+		$query = "SELECT count(*) as co from dict where word = ? ";
+		$row=PDO_FetchOne($query,array($word));
 		if($row[0]==0){
 			return false;
 		}
@@ -141,9 +133,9 @@ switch($op){
 	case "pre"://预查询
 		PDO_Connect("sqlite:"._FILE_DB_REF_INDEX_);
 		echo "<div>";
-		$query = "select word,count from dict where \"eword\" like ".$PDO->quote($word.'%')." OR \"word\" like ".$PDO->quote($word.'%')."  limit 0,20";
+		$query = "SELECT word,count from dict where eword like ?  OR word like ?  limit 0,20";
 
-		$Fetch = PDO_FetchAll($query);
+		$Fetch = PDO_FetchAll($query,array($word.'%',$word.'%'));
 		$iFetch=count($Fetch);
 		if($iFetch>0){
 			for($i=0;$i<$iFetch;$i++){
@@ -157,14 +149,14 @@ switch($op){
 		echo "</div>";
 		break;
 	case "search":
-		add_edit_event("lookup");
+		add_edit_event(_DICT_LOOKUP_,$word);
 		echo "<div id='dict_list_shell' onclick='setNaviVisibility()'><div id='dict_list' class='dict_list_off'></div></div>";
 		echo "<div id='dict_ref'>";	
 		$dict_list_a = [];
 		//社区字典开始
 		PDO_Connect("sqlite:"._FILE_DB_WBW_);
-		$query = "select *  from dict where \"pali\"= ".$PDO->quote($word)." limit 0,100";
-		$Fetch = PDO_FetchAll($query);
+		$query = "SELECT *  from dict where pali = ? limit 0,100";
+		$Fetch = PDO_FetchAll($query,array($word));
 		$iFetch=count($Fetch);
 		$count_return+=$iFetch;
 		if($iFetch>0){
@@ -206,9 +198,9 @@ switch($op){
 
 		PDO_Connect("sqlite:"._FILE_DB_REF_);
 		//直接查询
-		$query = "select dict.dict_id,dict.mean,info.shortname from dict LEFT JOIN info ON dict.dict_id = info.id where \"word\" = ".$PDO->quote($word)." limit 0,100";
+		$query = "SELECT dict.dict_id,dict.mean,info.shortname from dict LEFT JOIN info ON dict.dict_id = info.id where word = ? limit 0,100";
 		
-		$Fetch = PDO_FetchAll($query);
+		$Fetch = PDO_FetchAll($query,array($word));
 		$iFetch=count($Fetch);
 		$count_return+=$iFetch;
 		if($iFetch>0){
@@ -253,8 +245,8 @@ switch($op){
 
 		if(count($newWord)>0){
 			foreach($newWord as $x=>$x_value) {
-				$query = "select dict.dict_id,dict.mean,info.shortname from dict LEFT JOIN info ON dict.dict_id = info.id where \"word\" = ".$PDO->quote($x)." limit 0,30";
-				$Fetch = PDO_FetchAll($query);
+				$query = "SELECT dict.dict_id,dict.mean,info.shortname from dict LEFT JOIN info ON dict.dict_id = info.id where word = ? limit 0,30";
+				$Fetch = PDO_FetchAll($query,array($x));
 				$iFetch=count($Fetch);
 				$count_return+=$iFetch;
 				if($iFetch>0){
@@ -305,8 +297,8 @@ switch($op){
 			$word1=$org_word;
 			$wordInMean="%$org_word%";
 			echo "include $org_word:<br />";
-			$query = "select dict.dict_id,dict.word,dict.mean,info.shortname from dict LEFT JOIN info ON dict.dict_id = info.id where \"mean\" like ".$PDO->quote($wordInMean)." limit 0,30";
-			$Fetch = PDO_FetchAll($query);
+			$query = "SELECT dict.dict_id,dict.word,dict.mean,info.shortname from dict LEFT JOIN info ON dict.dict_id = info.id where mean like ? limit 0,30";
+			$Fetch = PDO_FetchAll($query,array($wordInMean));
 			$iFetch=count($Fetch);
 			$count_return+=$iFetch;
 			if($iFetch>0){

+ 1 - 1
app/dict/split.php

@@ -297,7 +297,7 @@ function microtime_float()
 
 function dict_lookup($word){
 	global $dbh;
-	$query = "select weight from part where \"word\" = ? ";
+	$query = "SELECT weight from part where word = ? ";
 	$stmt = $dbh->prepare($query);
 	$stmt->execute(array($word));
     $row = $stmt->fetch(PDO::FETCH_NUM);

+ 11 - 18
app/dict_builder/dict_find3.php

@@ -18,16 +18,9 @@ PDO_Connect("sqlite:$dictFileName");
 
 function isExsit($word){
 global $PDO;
-		$query = "select count(*) as co from dict where \"word\" = ".$PDO->quote($word);
-		$row=PDO_FetchOne($query);
-		/*
-		$Fetch = PDO_FetchAll($query);
-		$iFetch=count($Fetch);
-		$count_return+=$iFetch;
-		if($iFetch>0){
-		
-		}
-		*/
+		$query = "SELECT count(*) as co from dict where \"word\" = ?";
+		$row=PDO_FetchOne($query,array($word));
+
 		if($row[0]==0){
 			return false;
 		}
@@ -134,8 +127,8 @@ function mySplit($strWord){
 switch($op){
 	case "pre"://预查询
 		echo "<wordlist>";
-		$query = "select word,count(*) as co from dict where \"eword\" like ".$PDO->quote($word.'%')." OR \"word\" like ".$PDO->quote($word.'%')." group by word order by length limit 0,100";
-		$Fetch = PDO_FetchAll($query);
+		$query = "SELECT word,count(*) as co from dict where \"eword\" like ? OR \"word\" like ? group by word order by length limit 0,100";
+		$Fetch = PDO_FetchAll($query,array($word.'%',$word.'%'));
 		$iFetch=count($Fetch);
 		if($iFetch>0){
 			for($i=0;$i<$iFetch;$i++){
@@ -151,9 +144,9 @@ switch($op){
 		break;
 	case "search":
 		//直接查询
-		$query = "select dict.dict_id,dict.mean,info.shortname from dict LEFT JOIN info ON dict.dict_id = info.id where \"word\" = ".$PDO->quote($word)." limit 0,30";
+		$query = "SELECT dict.dict_id,dict.mean,info.shortname from dict LEFT JOIN info ON dict.dict_id = info.id where \"word\" = ? limit 0,30";
 		
-		$Fetch = PDO_FetchAll($query);
+		$Fetch = PDO_FetchAll($query,array($word));
 		$iFetch=count($Fetch);
 		$count_return+=$iFetch;
 		if($iFetch>0){
@@ -189,8 +182,8 @@ switch($op){
 
 		if(count($newWord)>0){
 			foreach($newWord as $x=>$x_value) {
-				$query = "select dict.dict_id,dict.mean,info.shortname from dict LEFT JOIN info ON dict.dict_id = info.id where \"word\" = ".$PDO->quote($x)." limit 0,30";
-				$Fetch = PDO_FetchAll($query);
+				$query = "SELECT dict.dict_id,dict.mean,info.shortname from dict LEFT JOIN info ON dict.dict_id = info.id where \"word\" = ? limit 0,30";
+				$Fetch = PDO_FetchAll($query,array($x));
 				$iFetch=count($Fetch);
 				$count_return+=$iFetch;
 				if($iFetch>0){
@@ -237,8 +230,8 @@ switch($op){
 			$word1=$org_word;
 			$wordInMean="%$org_word%";
 			echo "include $org_word:<br />";
-			$query = "select dict.dict_id,dict.word,dict.mean,info.shortname from dict LEFT JOIN info ON dict.dict_id = info.id where \"mean\" like ".$PDO->quote($wordInMean)." limit 0,30";
-			$Fetch = PDO_FetchAll($query);
+			$query = "SELECT dict.dict_id,dict.word,dict.mean,info.shortname from dict LEFT JOIN info ON dict.dict_id = info.id where \"mean\" like ? limit 0,30";
+			$Fetch = PDO_FetchAll($query,array($wordInMean));
 			$iFetch=count($Fetch);
 			$count_return+=$iFetch;
 			if($iFetch>0){

+ 4 - 4
app/dict_builder/get_one_word.php

@@ -12,8 +12,8 @@ include "../public/_pdo.php";
 						
 		$dictFileName=_FILE_DB_REF_;
 		PDO_Connect("sqlite:$dictFileName");
-		$query = "select * from dict where id='$word_id'";
-		$Fetch = PDO_FetchAll($query);
+		$query = "SELECT * from dict where id = ? ";
+		$Fetch = PDO_FetchAll($query,array($word_id));
 		
 		$dictFileName=$dir_dict_3rd."all.db3";
 		PDO_Connect("sqlite:$dictFileName");
@@ -21,8 +21,8 @@ include "../public/_pdo.php";
 		foreach($Fetch as $word){
 			echo "<h3>".$word["paliword"]."</h3>";
 			if($word["status"]>1){
-				$query = "select * from dict where \"from\"='".$word["id"]."'";
-				$FetchRichWord = PDO_FetchAll($query);
+				$query = "SELECT * from dict where from = ? ";
+				$FetchRichWord = PDO_FetchAll($query,array($word["id"]));
 				echo "<div id='final_word'>";
 				echo "<div id='final_word_header'>已编辑数据<button onclick='final_word_show_hide()'>显示/隐藏</bnutton></div>";
 				echo "<div id='final_word_body'>";

+ 1 - 1
app/dict_builder/index - 副本.php

@@ -81,7 +81,7 @@ include "./_pdo.php";
 global $PDO;
 $dictFileName=$dir_dict_3rd."bhmf.db";
 PDO_Connect("sqlite:$dictFileName");
-		$query = "select * from dict where 1  limit 0,1000";
+		$query = "SELECT * from dict where 1  limit 0,1000";
 		$Fetch = PDO_FetchAll($query);
 		$iFetch=count($Fetch);
 		if($iFetch>0){

+ 5 - 5
app/dict_builder/index.php

@@ -151,7 +151,7 @@ else{
 
 		$dictFileName=_FILE_DB_REF_;
 		PDO_Connect("sqlite:$dictFileName");
-		$query = "select * from info where 1  limit 0,100";
+		$query = "SELECT * from info where 1  limit 0,100";
 		$Fetch = PDO_FetchAll($query);
 		$iFetch=count($Fetch);
 		if($iFetch>0){
@@ -170,8 +170,8 @@ else{
 			}
 		}
 		if($dict_id!=-1){
-			$query = "select count(*) from dict where dict_id='$dict_id' ";
-			$dict_count = PDO_FetchOne($query);
+			$query = "SELECT count(*) from dict where dict_id = ? ";
+			$dict_count = PDO_FetchOne($query,array($dict_id));
 			$totle_page=ceil($dict_count/$page_size);
 		}
 		else{
@@ -214,8 +214,8 @@ else{
 						<?php
 						if($dict_id!=-1){
 							$from=$page_no*$page_size;
-							$query = "select id, paliword,status from dict where dict_id='$dict_id' limit $from , $page_size";
-							$Fetch = PDO_FetchAll($query);
+							$query = "SELECT id, paliword,status from dict where dict_id = ? limit ? , ? ";
+							$Fetch = PDO_FetchAll($query,array($dict_id,$from,$page_size));
 							foreach($Fetch as $word){
 								$class_status="status_".$word["status"];
 								$str_status="";

+ 4 - 4
app/doc/coop.php

@@ -42,8 +42,8 @@ set (doc_id ,userid ,value)
     PDO_Connect("sqlite:"._FILE_DB_FILEINDEX_);
 
         echo "<input id='doc_coop_docid' type='hidden' value='{$_doc_id}' />";
-        $query = "select * from fileindex where id='{$_doc_id}' ";
-        $Fetch = PDO_FetchAll($query);
+        $query = "SELECT * from fileindex where id = ? ";
+        $Fetch = PDO_FetchAll($query,array($_doc_id));
         $iFetch=count($Fetch);
         if($iFetch>0){
 
@@ -102,8 +102,8 @@ set (doc_id ,userid ,value)
 
                 }
                 
-                $query = "select * from power where doc_id='{$_doc_id}' ";
-                $Fetch = PDO_FetchAll($query);
+                $query = "SELECT * from power where doc_id = ? ";
+                $Fetch = PDO_FetchAll($query,$_doc_id);
 
                 echo "<ul>";
                 foreach($Fetch as $row){

+ 6 - 6
app/doc/coopfilelist.php

@@ -16,20 +16,20 @@ else{
 }
 
     PDO_Connect("sqlite:"._FILE_DB_FILEINDEX_);
-    $query = "select * from power where user='{$_COOKIE["userid"]}' order by modify_time DESC";
-    $Fetch = PDO_FetchAll($query);
+    $query = "SELECT * from power where user = ? order by modify_time DESC";
+    $Fetch = PDO_FetchAll($query,array($_COOKIE["userid"]));
     $result=array();
     foreach($Fetch as $row){
-        $query = "select * from fileindex where id='{$row['doc_id']}'  ";
-        $FetchFile = PDO_FetchAll($query);
+        $query = "SELECT * from fileindex where id = ?  ";
+        $FetchFile = PDO_FetchAll($query,array($row['doc_id']));
         if(count($FetchFile)>0){
             $FetchFile[0]["power"]=$row["power"];
             $FetchFile[0]["power_status"]=$row["status"];
             $FetchFile[0]["power_create_time"]=$row["create_time"];
             $FetchFile[0]["power_modify_time"]=$row["modify_time"];
             $FetchFile[0]["user_name"]=ucenter_get($FetchFile[0]["user_id"],"");
-            $query = "select id from fileindex where parent_id='{$row['doc_id']}' and user_id='{$uid}'";
-            $FetchFile[0]["my_doc_id"] = PDO_FetchOne($query);
+            $query = "SELECT id from fileindex where parent_id = ? and user_id = ? ";
+            $FetchFile[0]["my_doc_id"] = PDO_FetchOne($query,array($row['doc_id'],$uid));
             $FetchFile[0]["path"] = _get_para_path($FetchFile[0]["book"],$FetchFile[0]["paragraph"]);
             $result[] = $FetchFile[0];
         }

+ 2 - 2
app/doc/docinfo.php

@@ -19,8 +19,8 @@
     if(isset($_GET["id"])){
 
         $doc_id=$_GET["id"];
-        $query = "select * from fileindex where id='{$doc_id}' ";
-        $Fetch = PDO_FetchAll($query);
+        $query = "SELECT * from fileindex where id = ? ";
+        $Fetch = PDO_FetchAll($query,array($doc_id));
         $iFetch=count($Fetch);
         if($iFetch>0){
             //文档信息

+ 2 - 2
app/doc/edit_wbw.php

@@ -41,8 +41,8 @@ echo "<fieldset>";
 echo "<legend>{$_local->gui->channel} ({$_local->gui->required})</legend>";
 echo "<div>";
 PDO_Connect("sqlite:"._FILE_DB_CHANNAL_);
-$query = "select * from channal where owner = '{$_COOKIE["userid"]}'   limit 0,100";
-$Fetch = PDO_FetchAll($query);
+$query = "SELECT * from channal where owner = ?   limit 0,100";
+$Fetch = PDO_FetchAll($query,array($_COOKIE["userid"]));
 $i=0;
 foreach($Fetch as $row){
     echo '<div class="file_list_row" style="padding:5px;">';

+ 14 - 0
app/nissaya/get.php

@@ -1,6 +1,7 @@
 <?php
 require_once "../public/_pdo.php";
 require_once "../path.php";
+require_once "../ucenter/active.php";
 
 $result["error"]="";
 $result["data"]=array();
@@ -22,6 +23,19 @@ else{
 	exit;
 }
 
+if(isset($_GET["begin"])){
+	$begin = $_GET["begin"];
+}
+else{
+	$begin = 0;
+}
+if(isset($_GET["end"])){
+	$end = $_GET["end"];
+}
+else{
+	$end = 0;
+}
+add_edit_event(_NISSAYA_FIND_,"{$book}-{$para}-{$begin}-{$end}");
 
 PDO_Connect("sqlite:"._FILE_DB_PAGE_INDEX_);
 $query = "SELECT * from m where book=? and para=?";

+ 29 - 2
app/nissaya/index.php

@@ -16,9 +16,36 @@ require_once "../pcdl/html_head.php";
     width: 100vw;	
 }
 </style>
+<?php
+if(isset($_GET["book"])){
+	$book = $_GET["book"];
+}
+else{
+	$book = 0;
+}
+if(isset($_GET["para"])){
+	$para = $_GET["para"];
+}
+else{
+	$para = 0;
+}
+if(isset($_GET["begin"])){
+	$begin = $_GET["begin"];
+}
+else{
+	$begin = 0;
+}
+if(isset($_GET["end"])){
+	$end = $_GET["end"];
+}
+else{
+	$end = 0;
+}
+?>
 <script>
-_nissaya_book = <?php echo $_GET["book"];?>;
-_nissaya_para = <?php echo $_GET["para"];?>;
+$(document).ready(function () {
+	nissaya_get(<?php echo "{$book},{$para},{$begin},{$end}";?>);
+});
 </script>
 
 <div id="contence">

+ 4 - 18
app/nissaya/nissaya.js

@@ -1,13 +1,8 @@
-var _nissaya_book = 0;
-var _nissaya_para = 0;
 var _nsy_book_dir = "";
 var _nsy_book_id = "";
 
-$(document).ready(function () {
-	nissaya_get(_nissaya_book, _nissaya_para);
-});
-function nissaya_get(book, para) {
-	if (book == 0 || _nissaya_para == 0) {
+function nissaya_get(book, para, begin = 0, end = 0) {
+	if (book == 0 || para == 0) {
 		return;
 	}
 	$.get(
@@ -15,6 +10,8 @@ function nissaya_get(book, para) {
 		{
 			book: book,
 			para: para,
+			begin: begin,
+			end: end,
 		},
 		function (data) {
 			let result = JSON.parse(data);
@@ -23,10 +20,7 @@ function nissaya_get(book, para) {
 					//找到的书的列表
 					for (const iterator of result.data) {
 					}
-					//_nsy_book_dir = data.bookid.split("_")[0];
-					//_nsy_book_id = result.data[0].nsyid;
 					$("#contence").html(render_nissaya_init(result.data[0]));
-					//insert_new_befor(1);
 					insert_new_end(1);
 				}
 			}
@@ -56,14 +50,6 @@ function render_nissaya_init(data) {
 		page: data.nsypagenumber,
 		show: true,
 	});
-	/*
-	let filename = dir + "/" + data.nsyid + "_" + data.nsypagenumber + ".gif";
-	let html = "";
-	html += "<div class='img_box' dir='" + dir + "' book='" + data.nsyid + "' page='" + data.nsypagenumber + "'>";
-	html += "<img src='../../tmp/nissaya/" + filename + "' />";
-	html += "</div>";
-	return html;
-	*/
 }
 
 function insert_new_befor(num = 2) {

+ 1 - 0
app/path.php

@@ -85,5 +85,6 @@ define("_FILE_DB_USER_ARTICLE_"  , __DIR__."/../tmp/user/article.db3");
 define("_FILE_DB_HOSTSETTING_"  , __DIR__."/../tmp/user/hostsetting.db3");
 define("_FILE_DB_USER_SENTENCE_HISTORAY_"  , __DIR__."/../tmp/user/usent_historay.db3");
 define("_FILE_DB_USER_ACTIVE_"  , __DIR__."/../tmp/user/user_active.db3");
+define("_FILE_DB_USER_ACTIVE_LOG_"  , __DIR__."/../tmp/user/user_active_log.db3");
 
 ?>

+ 16 - 0
app/public/php/define.php

@@ -6,4 +6,20 @@ define("_CONTENT_VISIBILITY_PRIVATE_" , 10);
 define("_CONTENT_VISIBILITY_UNLISTED_" , 20);
 define("_CONTENT_VISIBILITY_PUBLIC_" , 30);
 
+#用户操作
+define("_CHANNEL_EDIT_",10);
+define("_CHANNEL_NEW_",11);
+define("_ARTICLE_EDIT_",20);
+define("_ARTICLE_NEW_",21);
+define("_DICT_LOOKUP_",30);
+define("_TERM_EDIT_",40);
+define("_TERM_LOOKUP_",41);
+define("_WBW_EDIT_",60);
+define("_SENT_EDIT_",70);
+define("_SENT_NEW_",71);
+define("_COLLECTION_EDIT_",80);
+define("_COLLECTION_NEW_",81);
+define("_NISSAYA_FIND_",90);
+
+
 ?>

+ 1 - 0
app/reader/reader.js

@@ -126,6 +126,7 @@ function reader_draw_para_menu() {
 			html += "<a onclick=\"junp_to_para('" + _reader_book + "','" + strPara + "')\">仅显示此段</a>";
 		}
 		html += "<a onclick=\"edit_wbw('" + _reader_book + "','" + strPara + "')\">" + gLocal.gui.edit_now + "</a>";
+		html += "<a  onclick='goto_nissaya(" + _reader_book + "," + strPara + ")'>" + gLocal.gui.show_nissaya + "</a>";
 		html +=
 			"<a onclick=\"copy_para_ref('" + _reader_book + "','" + strPara + "')\">" + gLocal.gui.copy_link + "</a>";
 		html +=

File diff suppressed because it is too large
+ 455 - 475
app/studio/js/common.js


File diff suppressed because it is too large
+ 525 - 535
app/studio/js/data.js


+ 2 - 3
app/studio/js/editor.js

@@ -655,9 +655,8 @@ function dictDataParse(xmlDictData, dictID) {
 }
 
 function pushNewDictItem(inArray, objNew) {
-	//var isExist=false;
-	for (indexList in inArray) {
-		if (inArray[indexList].Id == objNew.Id && inArray[indexList].dictID == objNew.dictID) {
+	for (const iterator of inArray) {
+		if (iterator.Id == objNew.Id && iterator.dictID == objNew.dictID) {
 			return;
 		}
 	}

+ 13 - 47
app/studio/plugin/system_export/module_function.js

@@ -10,51 +10,17 @@
  */
 
 function export_copy_doc_sent_link() {
-  let sent_list = _user_sent_buffer.getSent();
-  let sent_link = "";
-  let para = -1;
-  for (const iterator of sent_list) {
-    if (iterator.para != para) {
-      if (para != -1) {
-        sent_link += "\n";
-      }
-      para = iterator.para;
-    }
-    sent_link +=
-      "{{" +
-      iterator.book +
-      "-" +
-      iterator.para +
-      "-" +
-      iterator.start +
-      "-" +
-      iterator.end +
-      "}}\n";
-  }
-  $("#doc_sent_export").val(sent_link);
-  /*
-  const block_list = doc_block();
-  for (const iterator of block_list) {
-    let xmlParInfo = iterator.getElementsByTagName("info")[0];
-    if (xmlParInfo) {
-      let type = getNodeText(xmlParInfo, "type");
-      if (type == "wbw") {
-        let book = getNodeText(xmlParInfo, "book");
-        let para = getNodeText(xmlParInfo, "paragraph");
-        let xmlParData = iterator.getElementsByTagName("data")[0];
-        if (xmlParData) {
-          let ibegin = -1;
-          let iEnd = -1;
-          let word_list = xmlParData.getElementsByTagName("word");
-          for (const xWord of word_list) {
-            const id = xWord.getNodeText(xWord, "id").split("-");
-            if (ibegin == -1) {
-              ibegin = id[3];
-            }
-          }
-        }
-      }
-    }
-  }
-  */
+	let sent_list = _user_sent_buffer.getSent();
+	let sent_link = "";
+	let para = -1;
+	for (const iterator of sent_list) {
+		if (iterator.para != para) {
+			if (para != -1) {
+				sent_link += "\n";
+			}
+			para = iterator.para;
+		}
+		sent_link += "{{" + iterator.book + "-" + iterator.para + "-" + iterator.start + "-" + iterator.end + "}}\n";
+	}
+	$("#doc_sent_export").val(sent_link);
 }

+ 13 - 3
app/term/note.js

@@ -442,7 +442,17 @@ function note_json_html(in_json) {
 		gLocal.gui.related_para +
 		"</a>";
 	output +=
-		"<a  onclick='goto_nissaya(" + in_json.book + "," + in_json.para + ")'>" + gLocal.gui.show_nissaya + "</a>";
+		"<a  onclick='goto_nissaya(" +
+		in_json.book +
+		"," +
+		in_json.para +
+		"," +
+		in_json.begin +
+		"," +
+		in_json.end +
+		")'>" +
+		gLocal.gui.show_nissaya +
+		"</a>";
 	output +=
 		"<a onclick=\"copy_ref('" +
 		in_json.book +
@@ -895,8 +905,8 @@ function copy_ref(book, para, begin, end) {
 	copy_to_clipboard(strRef);
 }
 
-function goto_nissaya(book, para) {
-	window.open("../nissaya/index.php?book=" + book + "&para=" + para, "nissaya");
+function goto_nissaya(book, para, begin = 0, end = 0) {
+	window.open("../nissaya/index.php?book=" + book + "&para=" + para + "&begin=" + begin + "&end=" + end, "nissaya");
 }
 function edit_in_studio(book, para, begin, end) {
 	wbw_channal_list_open(book, [para]);

+ 20 - 1
app/ucenter/active.php

@@ -2,8 +2,10 @@
 //统计用户经验值
 require_once '../path.php';
 require_once "../public/function.php";
+require_once "../public/php/define.php";
 
-function add_edit_event($type="",$data=null){
+
+function add_edit_event($type=0,$data=null){
 	date_default_timezone_set("UTC");
 	define("MAX_INTERVAL",600000);
 	define("MIN_INTERVAL",60000);
@@ -12,6 +14,8 @@ function add_edit_event($type="",$data=null){
 		$dns = "sqlite:"._FILE_DB_USER_ACTIVE_;
 		$dbh = new PDO($dns, "", "",array(PDO::ATTR_PERSISTENT=>true));
 		$dbh->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_WARNING);
+
+		
 		// 查询上次编辑活跃结束时间
 		$query = "SELECT id, end, start,hit  FROM edit WHERE user_id = ? order by end DESC";
 		$stmt = $dbh->prepare($query);
@@ -105,6 +109,21 @@ function add_edit_event($type="",$data=null){
 		}
 		#更新经验总量表结束
 
+		#更新log
+		if($type > 0){
+			$dns = "sqlite:"._FILE_DB_USER_ACTIVE_LOG_;
+			$dbh_log = new PDO($dns, "", "",array(PDO::ATTR_PERSISTENT=>true));
+			$dbh_log->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_WARNING);
+
+			$query="INSERT INTO log ( user_id, active , content , time , timezone )  VALUES  ( ? , ? , ? , ? ,? ) ";
+			$sth = $dbh_log->prepare($query);
+			$sth->execute(array($_COOKIE["uid"] , $type , $data, $currTime,$client_timezone ) );
+			if (!$sth || ($sth && $sth->errorCode() != 0)) {
+				$error = $dbh->errorInfo();
+			}			
+		}
+
+		#更新log结束
 	}
 }
 

+ 67 - 0
app/ucenter/active_list.php

@@ -0,0 +1,67 @@
+<html>
+<body>
+<?php 
+//显示log
+require_once '../path.php';
+require_once "../public/function.php";
+require_once "../public/php/define.php";
+
+if(isset($_COOKIE["uid"])){
+	$active_type[10] = "_CHANNEL_EDIT_";
+	$active_type[11] = "_CHANNEL_NEW_";
+	$active_type[20] = "_ARTICLE_EDIT_";
+	$active_type[21] = "_ARTICLE_NEW_";
+	$active_type[30] = "_DICT_LOOKUP_";
+	$active_type[40] = "_TERM_EDIT_";
+	$active_type[41] = "_TERM_LOOKUP_";
+	$active_type[60] = "_WBW_EDIT_";
+	$active_type[70] = "_SENT_EDIT_";
+	$active_type[71] = "_SENT_NEW_";
+	$active_type[80] = "_COLLECTION_EDIT_";
+	$active_type[81] = "_COLLECTION_NEW_";
+	$active_type[90] = "_NISSAYA_FIND_";
+
+	$dns = "sqlite:"._FILE_DB_USER_ACTIVE_LOG_;
+	$dbh = new PDO($dns, "", "",array(PDO::ATTR_PERSISTENT=>true));
+	$dbh->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_WARNING);
+	$query = "SELECT time,active,content,timezone  FROM log WHERE user_id = ? ";
+		$stmt = $dbh->prepare($query);
+		$stmt->execute(array($_COOKIE["uid"]));
+		echo "<table>";
+		
+		while($row = $stmt->fetch(PDO::FETCH_ASSOC)){
+			echo "<tr>";	
+			foreach ($row as $key => $value) {
+				# code...
+				
+				switch ($key) {
+					case 'active':
+						# code...
+						$output =  isset($active_type[$value])? $active_type[$value] : $value;
+						break;
+					case 'time':
+						# code...
+						$output =  gmdate("Y-m-d H:i:s",($value+$row["timezone"])/1000);
+						break;
+					case 'timezone':
+						# code...
+						$output = round($value/1000/60/60,2) ;
+						break;
+					default:
+						# code...
+						$output =  $value;
+						break;
+				}
+				echo "<td>$output</td>";
+			}
+			echo "</tr>";
+		}
+		
+		echo "</table>";
+}
+else{
+	echo "尚未登录";
+}
+?>
+</body>
+</html>

+ 2 - 3
app/usent/sent_post.php

@@ -67,20 +67,19 @@ else{
     exit;
 }
 
-
+add_edit_event(_SENT_EDIT_,"{$_POST["book"]}-{$_POST["para"]}-{$_POST["begin"]}-{$_POST["end"]}@{$_POST["channal"]}");
 
 PDO_Connect("sqlite:"._FILE_DB_SENTENCE_);
 
 $_id = false;
 if( (isset($_POST["id"]) && empty($_POST["id"])) || !isset($_POST["id"]) ){
-    add_edit_event("sent",array("book"=>$_POST["book"],"para"=>$_POST["para"]));
+
         # 判断是否已经有了
         $query = "SELECT id FROM sentence WHERE book = ? AND paragraph = ? AND begin = ? AND end = ? AND channal = ? ";
         $_id = PDO_FetchOne($query,array($_POST["book"], $_POST["para"],  $_POST["begin"], $_POST["end"], $_POST["channal"]));
 }
 else{
     $_id = $_POST["id"];
-    add_edit_event("sent",array("id"=>$_POST["id"]));
 }
 
 

+ 42 - 38
app/usent/update.php

@@ -23,7 +23,7 @@ else{
     $_landmark = "";
 }
 
-add_edit_event("sent",array("book"=>0,"para"=>0));
+
 
 $aData=json_decode($_POST["data"],TRUE);
 
@@ -57,57 +57,61 @@ foreach ($aData as $data) {
 $update_list = array(); //已经成功修改数据库的数据 回传客户端
 
 /* 修改现有数据 */
-$PDO->beginTransaction();
-$query="UPDATE sentence SET text= ?  , status = ? , strlen = ? , receive_time= ?  , modify_time= ?   where  id= ?  ";
-$sth = $PDO->prepare($query);
+if(count($oldList)>0){
+	add_edit_event(_SENT_EDIT_,"{$oldList[0]["book"]}-{$oldList[0]["paragraph"]}-{$oldList[0]["begin"]}-{$oldList[0]["end"]}@{$oldList[0]["channal"]}");	
 
+	$PDO->beginTransaction();
+	$query="UPDATE sentence SET text= ?  , status = ? , strlen = ? , receive_time= ?  , modify_time= ?   where  id= ?  ";
+	$sth = $PDO->prepare($query);
 
-foreach ($oldList as $data) {
-	if(isset($data["id"])){
-		if(isset($data["time"])){
-			$modify_time = $data["time"];
-		}
-		else{
-			$modify_time = mTime();
-		}
-		$sth->execute(array($data["text"], $data["status"], mb_strlen($data["text"],"UTF-8"), mTime(),$modify_time,$data["id"]));
-	} 
-}
 
-$PDO->commit();
+	foreach ($oldList as $data) {
+		if(isset($data["id"])){
+			if(isset($data["time"])){
+				$modify_time = $data["time"];
+			}
+			else{
+				$modify_time = mTime();
+			}
+			$sth->execute(array($data["text"], $data["status"], mb_strlen($data["text"],"UTF-8"), mTime(),$modify_time,$data["id"]));
+		} 
+	}
 
-$respond=array("status"=>0,"message"=>"","insert_error"=>"","new_list"=>array());
+	$PDO->commit();
 
-if (!$sth || ($sth && $sth->errorCode() != 0)) {
-	/*  识别错误且回滚更改  */
-	$PDO->rollBack();
-	$error = PDO_ErrorInfo();
-	$respond['status']=1;
-	$respond['message']=$error[2];
-}
-else{
-	#没错误 更新历史记录
-	foreach ($oldList as $data) {
-		$respond['message']=update_historay($data["id"],$_COOKIE["userid"] ,$data["text"],$_landmark);
-		if($respond['message']!==""){
-			$respond['status']=1;
-			echo json_encode($respond, JSON_UNESCAPED_UNICODE);
-			exit;
-		}
+	$respond=array("status"=>0,"message"=>"","insert_error"=>"","new_list"=>array());
+
+	if (!$sth || ($sth && $sth->errorCode() != 0)) {
+		/*  识别错误且回滚更改  */
+		$PDO->rollBack();
+		$error = PDO_ErrorInfo();
+		$respond['status']=1;
+		$respond['message']=$error[2];
 	}
-	$respond['status']=0;
-	$respond['message']="成功";
-	foreach ($oldList as $key => $value) {
-		$update_list[] =  array("id" => $value["id"],"book"=>$value["book"],"paragraph"=>$value["paragraph"],"begin"=>$value["begin"],"end"=>$value["end"],"channal"=>$value["channal"],"text" => $value["text"]);
+	else{
+		#没错误 添加log 更新历史记录 
+		foreach ($oldList as $data) {
+			$respond['message']=update_historay($data["id"],$_COOKIE["userid"] ,$data["text"],$_landmark);
+			if($respond['message']!==""){
+				$respond['status']=1;
+				echo json_encode($respond, JSON_UNESCAPED_UNICODE);
+				exit;
+			}
+		}
+		$respond['status']=0;
+		$respond['message']="成功";
+		foreach ($oldList as $key => $value) {
+			$update_list[] =  array("id" => $value["id"],"book"=>$value["book"],"paragraph"=>$value["paragraph"],"begin"=>$value["begin"],"end"=>$value["end"],"channal"=>$value["channal"],"text" => $value["text"]);
 
+		}
 	}
 }
 
-
 /* 插入新数据 */
 //查询channel语言
 
 if(count($newList)>0){
+	add_edit_event(_SENT_NEW_,"{$newList[0]["book"]}-{$newList[0]["paragraph"]}-{$newList[0]["begin"]}-{$newList[0]["end"]}@{$newList[0]["channal"]}");	
 	$PDO->beginTransaction();
 	$query = "INSERT INTO sentence (id, 
 									parent,

+ 46 - 49
app/uwbw/update.js

@@ -1,80 +1,77 @@
-var user_wbw_data_buffer=new Array();
+var user_wbw_data_buffer = new Array();
 
-function user_wbw_push_paragraph(blockid){
-	
-}
+function user_wbw_push_paragraph(blockid) {}
 
-function user_wbw_push_word_element(xWord){
-	let wordid=getNodeText(xWord,"id");
+function user_wbw_push_word_element(xWord) {
+	let wordid = getNodeText(xWord, "id");
 	let wId = wordid.split("-")[2];
-	let mWord = doc_word("#"+wordid);
-	let blockid=mWord.block.info("id");
-	user_wbw_push(blockid,wId,com_xmlToString(xWord));	
+	let mWord = doc_word("#" + wordid);
+	let blockid = mWord.block.info("id");
+	user_wbw_push(blockid, wId, com_xmlToString(xWord));
 }
 
-function user_wbw_push_word(wordid){
-	let xWord = doc_word("#"+wordid);
-	let blockid=xWord.block.info("id");	
-	let book=xWord.block.info("book");
-	let para = 	xWord.block.info("paragraph");
+function user_wbw_push_word(wordid) {
+	let xWord = doc_word("#" + wordid);
+	let blockid = xWord.block.info("id");
+	let book = xWord.block.info("book");
+	let para = xWord.block.info("paragraph");
 
 	let aWordid = wordid.split("-");
-	aWordid.length=3;
-	if(para!=aWordid[1]){
+	aWordid.length = 3;
+	if (para != aWordid[1]) {
 		alert("error:paragraph sn.");
 		return;
 	}
-	let newWordid=aWordid.join("-");
+	let newWordid = aWordid.join("-");
 	let wId = aWordid[2];
-	let xAllWord = gXmlBookDataBody.getElementsByTagName("word");	
-	let index=getWordIndex(newWordid);
+	let xAllWord = gXmlBookDataBody.getElementsByTagName("word");
+	let index = getWordIndex(newWordid);
 	let wordData = "";
-	if(xAllWord[index]){
-		for(let i=index;i<xAllWord.length;i++){
-			if(getNodeText(xAllWord[i],"id").split("-")[2]!=wId){
+	if (xAllWord[index]) {
+		for (let i = index; i < xAllWord.length; i++) {
+			if (getNodeText(xAllWord[i], "id").split("-")[2] != wId) {
 				break;
 			}
 			wordData += com_xmlToString(xAllWord[i]);
-			
 		}
-		user_wbw_push(blockid,wId,wordData);
+		user_wbw_push(blockid, wId, wordData);
 	}
-
 }
 
-function user_wbw_push(block_id,wid,data){
+function user_wbw_push(block_id, wid, data) {
 	let d = new Date();
 	let objData = new Object();
-	objData.block_id=block_id;
+	objData.block_id = block_id;
 	objData.word_id = wid;
 	objData.data = data;
 	objData.time = d.getTime();
+	objData.book = doc_block("#" + block_id).info("book");
+	objData.para = doc_block("#" + block_id).info("paragraph");
 	user_wbw_data_buffer.push(objData);
 }
 
-function user_wbw_commit(){
-
-	if(user_wbw_data_buffer.length==0){
+function user_wbw_commit() {
+	if (user_wbw_data_buffer.length == 0) {
 		return;
 	}
-	$.post("../uwbw/update.php",
-	{
-		data:JSON.stringify(user_wbw_data_buffer)
-	},
-	function(data,status){
-		try{
-			let result= JSON.parse(data);
-			if(result.status==0){
-				ntf_show("user wbw"+result.message);
+	$.post(
+		"../uwbw/update.php",
+		{
+			data: JSON.stringify(user_wbw_data_buffer),
+		},
+		function (data, status) {
+			try {
+				let result = JSON.parse(data);
+				if (result.status == 0) {
+					ntf_show("user wbw" + result.message);
+				} else {
+					ntf_show("user wbw error" + result.message);
+				}
+			} catch (e) {
+				console.error("user_wbw_update:" + e + " data:" + data);
+				ntf_show("user wbw");
 			}
-			else{
-				ntf_show("user wbw error"+result.message);
-			}
-		}
-		catch(e){
-			console.error("user_wbw_update:"+e+" data:"+data);
-			ntf_show("user wbw");
 		}
-	});
-	user_wbw_data_buffer=new Array();
-}
+	);
+	user_wbw_data_buffer = new Array();
+}

+ 39 - 22
app/uwbw/update.php

@@ -7,36 +7,53 @@ require_once "../public/_pdo.php";
 require_once "../public/function.php";
 require_once "../ucenter/active.php";
 
+$respond['status']=0;
+$respond['message']="";
 
-$aData=json_decode($_POST["data"]);
+if(isset($_POST["data"])){
+	$aData=json_decode($_POST["data"]);
+}
+else{
+	$respond['status']=1;
+	$respond['message']="no data";
+	echo json_encode(array(), JSON_UNESCAPED_UNICODE);
+	exit;
+}
 
-add_edit_event("wbw",array("book"=>0,"para"=>0));
+if(count($aData)>0){
+	add_edit_event(_WBW_EDIT_,"{$aData[0]->book}-{$aData[0]->para}-{$aData[0]->word_id}");
 
-PDO_Connect("sqlite:"._FILE_DB_USER_WBW_);
+	PDO_Connect("sqlite:"._FILE_DB_USER_WBW_);
 
-/* 开始一个事务,关闭自动提交 */
-$PDO->beginTransaction();
-$query="UPDATE wbw SET data= ?  , receive_time= ?  , modify_time= ?   where block_id= ?  and wid= ?  ";
-$sth = $PDO->prepare($query);
+	/* 开始一个事务,关闭自动提交 */
+	$PDO->beginTransaction();
+	$query="UPDATE wbw SET data= ?  , receive_time= ?  , modify_time= ?   where block_id= ?  and wid= ?  ";
+	$sth = $PDO->prepare($query);
 
-foreach ($aData as $data) {
-    $sth->execute(array($data->data,mTime(),$data->time,$data->block_id,$data->word_id));
-}
-$PDO->commit();
+	foreach ($aData as $data) {
+		$sth->execute(array($data->data,mTime(),$data->time,$data->block_id,$data->word_id));
+	}
+	$PDO->commit();
 
-$respond=array("status"=>0,"message"=>"");
+	$respond=array("status"=>0,"message"=>"");
 
-if (!$sth || ($sth && $sth->errorCode() != 0)) {
-	/*  识别错误且回滚更改  */
-	$PDO->rollBack();
-	$error = PDO_ErrorInfo();
-	$respond['status']=1;
-	$respond['message']=$error[2];
+	if (!$sth || ($sth && $sth->errorCode() != 0)) {
+		/*  识别错误且回滚更改  */
+		$PDO->rollBack();
+		$error = PDO_ErrorInfo();
+		$respond['status']=1;
+		$respond['message']=$error[2];
 
+	}
+	else{
+		$respond['status']=0;
+		$respond['message']="成功";
+	}		
+	echo json_encode($respond, JSON_UNESCAPED_UNICODE);	
 }
 else{
-	$respond['status']=0;
-	$respond['message']="成功";
-}		
-echo json_encode($respond, JSON_UNESCAPED_UNICODE);
+	$respond['status']=1;
+	$respond['message']="no data";
+	echo json_encode($respond, JSON_UNESCAPED_UNICODE);	
+}
 ?>

Some files were not shown because too many files changed in this diff