فهرست منبع

译文pull 完成

visuddhinanda 5 سال پیش
والد
کامیت
084338dede

+ 3 - 0
app/article/index.php

@@ -204,6 +204,9 @@ function GetPageScroll()
 }
 	</script>
 
+<div class="modal_win_bg">
+</div>
+<div id="model_win" class="iframe_container"></div>
 
 </body>
 </html>

+ 9 - 2
app/channal/channal.js

@@ -46,12 +46,18 @@ function my_channal_list() {
 						html += '<div class="file_list_row" style="padding:5px;">';
 						html += '<div style="max-width:2em;flex:1;"><input type="checkbox" /></div>';
 						html += "<div style='flex:1;'>" + key++ + "</div>";
-						html += "<div style='flex:2;'>" + iterator.name + "</div>";
 						html += "<div style='flex:2;'>";
-						if (iterator.username == "_you_") {
+						html += "<guide url='../channal/card.php' gid='" + iterator.id + "'>";
+						html += iterator.name;
+						html += "</guide>";
+						html += "</div>";
+						html += "<div style='flex:2;'>";
+						if (parseInt(iterator.power) == 30) {
 							html += gLocal.gui.your;
 						} else {
+							html += "<guide url='../ucenter/card.php' gid='" + iterator.owner + "'>";
 							html += iterator.nickname;
+							html += "</guide>";
 						}
 
 						html += "</div>";
@@ -112,6 +118,7 @@ function my_channal_list() {
 						html += "</div>";
 					}
 					$("#my_channal_list").html(html);
+					guide_init();
 				} catch (e) {
 					console.error(e);
 				}

+ 31 - 4
app/channal/function.php

@@ -30,14 +30,41 @@ class Channal
         $query = "SELECT * FROM channal WHERE id= ? ";
         $stmt = $this->dbh->prepare($query);
         $stmt->execute(array($id));
-        $channal = $stmt->fetchAll(PDO::FETCH_ASSOC);
-        if(count($channal)>0){
-            return $channal[0];
+        $channal = $stmt->fetch(PDO::FETCH_ASSOC);
+        if($channal){
+            return $channal;
         }
         else{
             return false;
         }
-    }
+	}
+	
+	public function getPower($id){
+		#查询用户对此channel是否有权限		
+		if(!isset($_COOKIE["userid"])){
+			return 0;
+		}
+		$channelPower = 0;
+		$query = "SELECT owner,status FROM channal WHERE id=? and status>0 ";
+		$stmt = $this->dbh->prepare($query);
+		$stmt->execute(array($id));
+		$channel = $stmt->fetch(PDO::FETCH_ASSOC);
+		if($channel){
+			if($channel["owner"]==$_COOKIE["userid"]){
+				return 30;
+			}
+			else if($channel["status"]>=30){
+				#全网公开的 可以提交pr
+				$channelPower = 10;
+			}
+		}
+
+		$sharePower = share_get_res_power($_COOKIE["userid"],$id);
+		if($sharePower>$channelPower){
+			$channelPower=$sharePower;
+		}
+		return $channelPower;
+	}
 
 }
 

+ 2 - 4
app/channal/get.php

@@ -66,14 +66,12 @@ foreach ($all as $key => $value) {
     # code...
 	$new = $value;
 	$name = $_userinfo->getName($value["owner"]);	
+	$new["username"] = $name["username"];
+	$new["nickname"] = $name["nickname"];	
 	if($value["owner"]===$_COOKIE["userid"]){
-		$new["username"] = "_you_";
-		$new["nickname"] = "_you_";
 		$new["power"] = 30;
 	}
 	else{
-		$new["username"] = $name["username"];
-		$new["nickname"] = $name["nickname"];		
 		$new["power"] = $value["power"];		
 	}
 

+ 61 - 0
app/commit/commit.css

@@ -0,0 +1,61 @@
+.commit_compare {
+	display: flex;
+	padding: 5px;
+	line-height: 1.8em;
+	border-bottom: 1px solid var(--border-line-color);
+}
+.commit_compare .pali {
+	flex: 3;
+}
+.commit_compare .src_text {
+	flex: 3;
+}
+.commit_compare .dest_text {
+	flex: 3;
+}
+
+del {
+	color: red;
+}
+ins {
+	color: green;
+}
+
+.commit_head {
+	display: flex;
+	justify-content: space-around;
+	padding-bottom: 10px;
+	margin-bottom: 10px;
+	border-bottom: 1px solid var(--border-line-color);
+}
+.commit_step {
+	text-align: center;
+}
+.commit_step .num {
+	font-size: 25px;
+	font-weight: 700;
+	color: var(--btn-color);
+	width: 50px;
+	line-height: 45px;
+	text-align: center;
+	border: 2px solid var(--link-color);
+	border-radius: 99px;
+}
+.step1 > .commit_step_1 > .num {
+	border-color: var(--link-hover-color);
+	color: var(--main-color);
+}
+.step2 > .commit_step_1 > .num,
+.step2 > .commit_step_2 > .num {
+	border-color: var(--link-hover-color);
+	color: var(--main-color);
+}
+.step3 > .commit_step_1 > .num,
+.step3 > .commit_step_2 > .num,
+.step3 > .commit_step_3 > .num {
+	border-color: var(--link-hover-color);
+	color: var(--main-color);
+}
+.commit_win_inner {
+	padding: 1em;
+}

+ 205 - 0
app/commit/commit.js

@@ -0,0 +1,205 @@
+var _commit_data;
+var previewWin;
+function commit_init(param) {
+	previewWin = model_win_init({ container: "model_win" });
+	_commit_data = param;
+
+	previewWin.show(commit_preview_render());
+}
+function commit_render_head(step) {
+	let html = "";
+	html += "<div class='commit_head step" + step + "'>";
+	html += "<div class='commit_step commit_step_1'><div class='num'>1</div><div>选择版本</div></div>";
+	html += "<div class='commit_step commit_step_2'><div class='num'>2</div><div>预览</div></div>";
+	html += "<div class='commit_step commit_step_3'><div class='num'>3</div><div>完成</div></div>";
+	html += "</div>";
+	return html;
+}
+function commit_render_channel_select() {
+	let html = "";
+	html += "<div class='commit_win_inner'>";
+	html += commit_render_head(1);
+	html += "<div>当前:";
+	html += "<select id='src_channel' onchange='src_change(this)'>";
+	if (typeof _commit_data.src == "undefined") {
+		html += "<option value='' selected>请选择当前版本</option>";
+	}
+	for (const iterator of _my_channal) {
+		html += "<option value='" + iterator.id + "' ";
+		if (_commit_data.src == iterator.id) {
+			html += " selected ";
+		}
+		html += ">" + iterator.name + "</option>";
+	}
+	html += "</select>";
+
+	html += "</div>";
+
+	html += "<div>推送到:";
+	html += "<select id='dest_channel' onchange='dest_change(this)'>";
+	if (typeof _commit_data.dest == "undefined") {
+		html += "<option value='' selected>请选择推送到</option>";
+	}
+	for (const iterator of _my_channal) {
+		html += "<option value='" + iterator.id + "' ";
+		if (_commit_data.dest == iterator.id) {
+			html += " selected ";
+		}
+		html += ">" + iterator.name + "</option>";
+	}
+	html += "</select>";
+	html += "</div>";
+	html += "<div id='commit_preview'></div>";
+
+	html += "<button onclick='previewWin.show(commit_preview_render())'>预览</button>";
+	html += "</div>";
+
+	return html;
+}
+
+function commit_preview_render() {
+	let html = "";
+	html += "<div class='commit_win_inner'>";
+	html += commit_render_head(2);
+
+	if (
+		typeof _commit_data.src != "undefined" &&
+		_commit_data.src != null &&
+		_commit_data.src != "" &&
+		typeof _commit_data.dest != "undefined" &&
+		_commit_data.dest != null &&
+		_commit_data.dest != ""
+	) {
+		let sentList = new Array();
+		for (const iterator of _arrData) {
+			sentList.push(iterator.book + "-" + iterator.para + "-" + iterator.begin + "-" + iterator.end);
+		}
+		_commit_data.sent = sentList;
+		let arrSentInfo = new Array();
+		for (const iterator of _commit_data.sent) {
+			let id = com_guid();
+			arrSentInfo.push({ id: id, data: iterator });
+		}
+
+		if (arrSentInfo.length > 0) {
+			let setting = new Object();
+			setting.lang = "";
+			setting.channal = _commit_data.src + "," + _commit_data.dest;
+			$.post(
+				"../term/note.php",
+				{
+					setting: JSON.stringify(setting),
+					data: JSON.stringify(arrSentInfo),
+				},
+				function (data, status) {
+					if (status == "success") {
+						let sentData;
+						let html = "";
+						try {
+							sentData = JSON.parse(data);
+						} catch (e) {}
+						html += "<div class='commit_win_inner'>";
+						html += commit_render_head(2);
+						html += "<div>";
+						html += "<button onclick='previewWin.show(commit_render_channel_select())'>返回</button>";
+						html += "<button onclick='commit_pull()'>推送</button>";
+						html += "<button onclick='commit_close()'>放弃</button>";
+						html += "</div>";
+						html += "<div class='commit_compare'>";
+						html += "<div class='pali'>巴利原文</div>";
+						html += "<div class='src_text'>当前版本:" + channal_getById(_commit_data.src).name + "</div>";
+						html += "<div class='dest_text'>推送到:" + channal_getById(_commit_data.dest).name + "</div>";
+						html += "</div>";
+
+						for (const iterator of sentData) {
+							if (iterator.translation[0].id != "") {
+								html += "<div class='commit_compare'>";
+								html += "<div ><input type='checkbox' /></div>";
+								html += "<div class='pali'>" + iterator.palitext + "</div>";
+								html += "<div class='src_text'>";
+								html += iterator.translation[0].text;
+								html += "</div>";
+								html += "<div class='dest_text'>";
+								if (iterator.translation[1].id == "") {
+									if (iterator.translation[0].id == "") {
+										html += "无记录";
+									} else {
+										html += "<ins>" + iterator.translation[0].text + "</ins>";
+									}
+								} else {
+									if (iterator.translation[0].update_time > iterator.translation[1].update_time) {
+										html += "<del>" + iterator.translation[1].text + "</del><br>";
+										html += "<ins>" + iterator.translation[0].text + "</ins>";
+									} else {
+										html += "[新]" + iterator.translation[1].text;
+									}
+								}
+								html += "</div>";
+								html += "</div>";
+							}
+						}
+						html += "</div>";
+
+						previewWin.show(html);
+						//$("#commit_preview").html(html);
+					}
+				}
+			);
+			html += "加载中 请稍等……";
+			html += "</div>";
+			return html;
+		} else {
+			html += "没有句子被选择";
+			html += "</div>";
+			return html;
+		}
+	} else {
+		return commit_render_channel_select();
+	}
+}
+function commit_render_final(result) {
+	let html = "";
+	html += "<div class='commit_win_inner'>";
+	html += commit_render_head(3);
+	if (typeof result.update != "undefined") {
+		html += "<div>修改:" + result.update + "</div>";
+	}
+	if (typeof result.insert != "undefined") {
+		html += "<div>新增:" + result.insert + "</div>";
+	}
+	if (typeof result.pr != "undefined") {
+		html += "<div>提交修改建议:" + result.pr + "</div>";
+	}
+	html +=
+		"<div><a href='' onclick='window.reload()'>刷新页面</a>查看修改结果。<a onclick='previewWin.close()'>关闭</a></div>";
+	html += "</div>";
+	return html;
+}
+function commit_pull() {
+	$.post(
+		"../commit/commit.php",
+		{
+			data: JSON.stringify(_commit_data),
+		},
+		function (data, status) {
+			if (status == "success") {
+				let html = "";
+				try {
+					let result = JSON.parse(data);
+					if (result.status == 0) {
+						previewWin.show(commit_render_final(result));
+					} else {
+						alert(result.message);
+					}
+				} catch (e) {}
+			}
+		}
+	);
+}
+function commit_close() {}
+function dest_change(obj) {
+	_commit_data.dest = $(obj).val();
+}
+function src_change(obj) {
+	_commit_data.src = $(obj).val();
+}

+ 122 - 0
app/commit/commit.php

@@ -0,0 +1,122 @@
+<?php 
+require_once "../path.php";
+require_once "../public/_pdo.php";
+require_once "../public/function.php";
+require_once "../channal/function.php";
+require_once "../redis/function.php";
+require_once "../share/function.php";
+require_once "../usent/function.php";
+
+$_data = array();
+if (isset($_POST["data"])) {
+    $_data = json_decode($_POST["data"], true);
+} else {
+	exit;
+}
+$channelInfo  = new Channal();
+$srcChannelPower = $channelInfo->getPower($_data["src"]);
+$destChannelPower = $channelInfo->getPower($_data["dest"]);
+
+if($srcChannelPower<10 || $destChannelPower<10){
+	exit;
+}
+
+$db_trans_sent = new PDO(_FILE_DB_SENTENCE_, "", "", array(PDO::ATTR_PERSISTENT => true));
+$db_trans_sent->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_WARNING);
+
+$query = "SELECT * FROM sentence WHERE book= ? AND paragraph= ? AND begin= ? AND end= ?  AND channal = ?  ";
+$stmt = $db_trans_sent->prepare($query);
+
+if($stmt){
+	$updateDate=array();
+	$insertData=array();
+	$prData=array();
+	$insertHistoray=array();
+	foreach ($_data["sent"] as $key => $value) {
+		# code...
+		$infoSrc = explode("-",$value);
+		$infoDest = $infoSrc;
+		$infoSrc[]=$_data["src"];
+		$infoDest[]=$_data["dest"];
+		$stmt->execute($infoSrc);
+		$fetchSrc = $stmt->fetch(PDO::FETCH_ASSOC);
+		if ($fetchSrc) {
+			# 有 源数据
+			$newData = $fetchSrc;
+			$newData["modify_time"]=mTime();
+			$newData["channal"]=$_data["dest"];
+			$newData["landmark"]="";
+			$stmt->execute($infoDest);
+			$fetchDest = $stmt->fetch(PDO::FETCH_ASSOC);
+			if ($fetchDest) {
+				#有目标数据,比较时间
+				if($fetchSrc["modify_time"]>$fetchDest["modify_time"]){
+					#新数据 更新
+					if($destChannelPower>=20){
+						#有权限 直接写入
+						$newData["id"]=$fetchDest["id"];
+						$updateDate[] = $newData;
+						$insertHistoray[] = $newData;
+					}
+					else{
+						#pr
+						$prData[] = $newData;
+					}
+				}
+			}
+			else{
+				#没有目标数据新增
+				if($destChannelPower>=20){
+					#有写入权限 直接写入
+					$newData["id"] = UUID::v4();
+					$insertData[] = $newData;
+					
+					$insertHistoray[] = $newData;
+				}
+				else{
+					#pr
+					$prData[] = $newData;
+				}
+			}
+		}
+	}
+	#到此,所有的数据已经准备好
+
+	$sentDb = new Sent_DB();
+	$respond['message'] = "";
+	$respond['status'] = 0;
+	if($sentDb->update($updateDate)){
+		$respond['update'] = count($updateDate);
+	}
+	else{
+		$respond['message'] = $sentDb->getError();
+        $respond['status'] = 1;
+	}
+	if($sentDb->insert($insertData)){
+		$respond['insert'] = count($insertData);
+
+	}else{
+		$respond['message'] = $sentDb->getError();
+        $respond['status'] = 1;
+	}
+	if($sentDb->send_pr($prData)){
+		$respond['pr'] = count($prData);
+
+	}else{
+		$respond['message'] = $sentDb->getError();
+        $respond['status'] = 1;
+	}
+	if($sentDb->historay($insertHistoray)){
+		$respond['historay'] = count($insertHistoray);
+
+	}else{
+		$respond['message'] = $sentDb->getError();
+        $respond['status'] = 1;
+	}
+}
+else{
+	$respond['message'] = $db_trans_sent->errorInfo();
+	$respond['status'] = 1;
+}
+echo json_encode($respond, JSON_UNESCAPED_UNICODE);
+?>

+ 7 - 0
app/pcdl/html_head.php

@@ -100,6 +100,13 @@ if (isset($_GET["language"])) {
 	<link type="text/css" rel="stylesheet" href="../term/pali_sim_dlg.css" />
 	<script src="../term/related_para.js"></script>
 
+	<script src="../widget/iframe_modal_win.js"></script>
+	<link type="text/css" rel="stylesheet" href="../widget/iframe_modal_win.css"/>
+
+	<script src="../commit/commit.js"></script>
+	<link type="text/css" rel="stylesheet" href="../commit/commit.css"/>
+
+
 	<script src="../inline_dict/inline_dict.js"></script>
 
 	<script src="../widget/click_dropdown.js"></script>

+ 32 - 13
app/share/function.php

@@ -13,7 +13,7 @@ function share_res_list_get($userid,$res_type=-1){
 	# 找我加入的群
 	$dbhGroup = new PDO(_FILE_DB_GROUP_, "", "");
     $dbhGroup->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_WARNING);
-	$query = "SELECT group_id from group_member where user_id = ?  limit 0,100";
+	$query = "SELECT group_id from group_member where user_id = ?  limit 0,200";
 	$stmtGroup = $dbhGroup->prepare($query);
 	$stmtGroup->execute(array($userid));
 	$my_group = $stmtGroup->fetchAll(PDO::FETCH_ASSOC);
@@ -29,45 +29,64 @@ function share_res_list_get($userid,$res_type=-1){
 	$PDO = new PDO(_FILE_DB_USER_SHARE_, "", "");
     $PDO->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_WARNING);
 	if($res_type==-1){
-		$query = "SELECT res_id,res_type,power FROM share_cooperator  WHERE is_deleted=0 AND cooperator_id IN ($place_holders) group by res_id ";
+		#所有类型资源
+		$query = "SELECT res_id,res_type,power FROM share_cooperator  WHERE is_deleted=0 AND cooperator_id IN ($place_holders) ";
 		$stmt = $PDO->prepare($query);
 		$stmt->execute($userList);
 		$Fetch =$stmt->fetchAll(PDO::FETCH_ASSOC);
 	}
 	else{
+		#指定类型资源
 		$userList[]=$res_type;
-		$query = "SELECT res_id,res_type,power FROM share_cooperator  WHERE is_deleted=0 AND  cooperator_id IN ($place_holders) AND res_type = ? group by res_id";
+		$query = "SELECT res_id,res_type,power FROM share_cooperator  WHERE is_deleted=0 AND  cooperator_id IN ($place_holders) AND res_type = ?";
 		$stmt = $PDO->prepare($query);
 		$stmt->execute($userList);
 		$Fetch =$stmt->fetchAll(PDO::FETCH_ASSOC);
 	}
 
+	$resOutput = array();
+	foreach ($Fetch as $key => $value) {
+		# 查重
+		if(isset($resOutput[$value["res_id"]])){
+			if($value["power"]>$resOutput[$value["res_id"]]["power"]){
+				$resOutput[$value["res_id"]]["power"] = $value["power"];
+			}
+		}
+		else{
+			$resOutput[$value["res_id"]]= array("power"=> $value["power"],"type" => $value["res_type"]);
+		}
+	}
+	$resList=array();
+	foreach ($resOutput as $key => $value) {
+		# code...
+		$resList[]=array("res_id"=>$key,"res_type"=>(int)$value["type"],"power"=>(int)$value["power"]);
+	}
 	$channel = new Channal(); 
-	foreach ($Fetch as $key => $res) {
+	foreach ($resList as $key => $res) {
 		# 获取资源标题 和所有者 
 		switch ($res["res_type"]) {
 			case 1:
 				# pcs 文档
-				$Fetch[$key]["res_title"]=pcs_get_title($res["res_id"]);
+				$resList[$key]["res_title"]=pcs_get_title($res["res_id"]);
 				break;
 			case 2:
 				# channel
 				$channelInfo = $channel->getChannal($res["res_id"]);
 				if($channelInfo){
-					$Fetch[$key]["res_title"]=$channelInfo["name"];
-					$Fetch[$key]["res_owner_id"]=$channelInfo["owner"];
+					$resList[$key]["res_title"]=$channelInfo["name"];
+					$resList[$key]["res_owner_id"]=$channelInfo["owner"];
 				}
 				else{
-					$Fetch[$key]["res_title"]="_unkown_";
-					$Fetch[$key]["res_owner_id"]="_unkown_";
+					$resList[$key]["res_title"]="_unkown_";
+					$resList[$key]["res_owner_id"]="_unkown_";
 				}
 				
 				break;
 			case 3:
-				# code...
+				# 3 Article 文章
 				break;
 			case 4:
-				# code...
+				# 4 Collection 文集
 				break;
 			case 5:
 				# code...
@@ -79,11 +98,11 @@ function share_res_list_get($userid,$res_type=-1){
 		}
 	}
 
-	return $Fetch;
+	return $resList;
 
 }
 
-//对某个共享资源的权限
+//获取对某个共享资源的权限
 function share_get_res_power($userid,$res_id){
 		# 找我加入的群
 		$dbhGroup = new PDO(_FILE_DB_GROUP_, "", "");

+ 2 - 4
app/share/share.php

@@ -45,9 +45,8 @@ input[type="text"], input[type="input"], input[type="password"], textarea{
 	<div class="item_block">
 		<h2>隐私设置</h2>
 		<ul>
-		<li><input type="radio" name="list" checked />私有</li>
-		<li><input type="radio" name="list" />公开列出</li>
-		<li><input type="radio" name="list" />公开编辑</li>
+			<li><input type="radio" name="list" checked />私有</li>
+			<li><input type="radio" name="list" />公开列出</li>
 		</ul>
 	</div>
 	<div class="item_block">
@@ -77,7 +76,6 @@ input[type="text"], input[type="input"], input[type="password"], textarea{
 			<select id="user_type" >
 				<option value="1">用户</option>
 				<option value="2">工作组</option>
-				<option value="3">项目</option>
 			</select>
 			</div>
 			<div id="user_search">

+ 6 - 1
app/term/note.js

@@ -225,13 +225,18 @@ function note_refresh_new() {
 						}
 						//处理<code>标签作为气泡注释
 						popup_init();
+
 						//刷新句子链接递归,有加层数限制。
-						note_refresh_new();
+						//note_refresh_new();
 
+						//将新的数据添加到数据总表
 						_arrData = _arrData.concat(sentData);
 						note_ref_init();
+						//获取术语字典
 						term_get_dict();
+						//刷新channel列表
 						note_channal_list();
+						//显示不同的巴利语脚本
 						refresh_pali_script();
 						//把巴利语单词用<w>分隔用于点词查询等
 						splite_pali_word();

+ 6 - 1
app/term/note.php

@@ -156,7 +156,9 @@ foreach ($_data as $key => $value) {
 
         $stmt = $db_trans_sent->prepare($query);
         if (empty($_setting["channal"])) {
+			#没有指定channel
             if ($sentChannal == "") {
+				#句子信息也没指定channel
                 $parm = array($bookId, $para, $begin, $end);
                 $parm = array_merge_recursive($parm, $channal_list);
                 $stmt->execute($parm);
@@ -169,6 +171,8 @@ foreach ($_data as $key => $value) {
                     }
                 }
             } else {
+				#句子信息包含channel
+				#{{book-para-begin-end@channelid}}
                 $stmt->execute(array($bookId, $para, $begin, $end, $sentChannal));
                 $Fetch = $stmt->fetch(PDO::FETCH_ASSOC);
                 if ($Fetch) {
@@ -178,13 +182,14 @@ foreach ($_data as $key => $value) {
                 }
             }
         } else {
+			#指定了channel
             $arrChannal = explode(",", $_setting["channal"]);
             foreach ($arrChannal as $key => $value) {
                 # code...
                 $stmt->execute(array($bookId, $para, $begin, $end, $value));
                 $Fetch = $stmt->fetch(PDO::FETCH_ASSOC);
                 if ($Fetch) {
-                    $translation[] = array("id" => $Fetch["id"], "text" => $Fetch["text"], "lang" => $Fetch["language"], "channal" => $value, "editor" => $Fetch["editor"]);
+                    $translation[] = array("id" => $Fetch["id"], "text" => $Fetch["text"], "lang" => $Fetch["language"], "channal" => $value, "editor" => $Fetch["editor"],"update_time"=>$Fetch["modify_time"]);
 
                 } else {
                     $translation[] = array("id" => "", "text" => "", "lang" => "", "channal" => $value);

+ 30 - 0
app/ucenter/card.php

@@ -0,0 +1,30 @@
+<?php
+//
+
+require_once "../path.php";
+require_once "../public/_pdo.php";
+require_once '../ucenter/function.php';
+
+
+if (isset($_GET["id"])) {
+	$output["id"]=$_GET["id"];
+	PDO_Connect( _FILE_DB_USERINFO_);
+    $query = "SELECT userid as id ,username,nickname,create_time FROM user WHERE userid=?";
+	$channel = PDO_FetchRow($query, array($_GET["id"]));
+	$strData="";
+	if ($channel) {
+		$strData .= "<div>昵称:".$channel["nickname"]."</div>";
+		$strData .=  "<div>用户名:".$channel["username"]."</div>";
+		$strData .=  "<div>注册时间:".date("Y/m/d",$channel["create_time"]/1000)."</div>";
+		$strData .=  "<div><a href='../uhome/index.php?userid=".$channel["id"]."' target='_blank'>个人空间</a></div>";
+	} else {
+		$strData .=  "unkow";
+	}
+	$output["data"] = $strData;
+} else {
+	$output["id"]=0;
+	$output["data"] = "unkow";
+}
+echo json_encode($output, JSON_UNESCAPED_UNICODE);
+
+?>

+ 5 - 5
app/ucenter/get.php

@@ -2,22 +2,22 @@
 require_once '../path.php';
 
 //打开数据库
-$dns = "" . _FILE_DB_USERINFO_;
-$dbh = new PDO($dns, "", "", array(PDO::ATTR_PERSISTENT => true));
+
+$dbh = new PDO(_FILE_DB_USERINFO_, "", "", array(PDO::ATTR_PERSISTENT => true));
 $dbh->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_WARNING);
 if (isset($_GET["id"])) {
 	if(isset($_GET["bio"])){
-		$query = "select bio,email from profile where user_id = ? ";
+		$query = "SELECT bio,email from profile where user_id = ? ";
 	}
 	else{
-		$query = "select userid as id ,username,nickname from user where userid = ? ";
+		$query = "SELECT userid as id ,username,nickname from user where userid = ? ";
 	}
     
     $stmt = $dbh->prepare($query);
     $stmt->execute(array($_GET["id"]));
     $fUser = $stmt->fetchAll(PDO::FETCH_ASSOC);
 } else if (isset($_GET["username"])) {
-    $query = "select userid as id ,username,nickname,email from user where  nickname like ? limit 0,8";
+    $query = "SELECT userid as id ,username,nickname,email from user where  nickname like ? limit 0,8";
     $stmt = $dbh->prepare($query);
     $username = "%" . $_GET["username"] . "%";
     $stmt->execute(array($username));

+ 223 - 0
app/usent/function.php

@@ -20,3 +20,226 @@ function update_historay($sent_id, $user_id, $text, $landmark)
         return "";
     }
 }
+
+class Sent_DB
+{
+    public $dbh_sent;
+	public $dbh_his;
+	private $errorMsg="";
+    public function __construct() {
+        $this->dbh_sent = new PDO(_FILE_DB_SENTENCE_, "", "",array(PDO::ATTR_PERSISTENT=>true));
+		$this->dbh_sent->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_WARNING);  
+		
+		$this->dbh_his = new PDO(_FILE_DB_USER_SENTENCE_HISTORAY_, "", "",array(PDO::ATTR_PERSISTENT=>true));
+        $this->dbh_his->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_WARNING);  
+	}
+	public function getError(){
+		return $errorMsg;
+	}
+	public function update($arrData){
+		/* 修改现有数据 */
+	
+		if (count($arrData) > 0) {
+			//add_edit_event(_SENT_EDIT_, "{$oldList[0]["book"]}-{$oldList[0]["paragraph"]}-{$oldList[0]["begin"]}-{$oldList[0]["end"]}@{$oldList[0]["channal"]}");
+	
+			$this->dbh_sent->beginTransaction();
+			$query = "UPDATE sentence SET text = ? , strlen = ? , editor=?, modify_time= ?   where  id= ?  ";
+			$sth = $this->dbh_sent->prepare($query);
+	
+			foreach ($arrData as $data) {
+				$sth->execute(array($data["text"],mb_strlen($data["text"],"UTF-8"),$data["editor"],mTime(),$data["id"]));
+			}
+	
+			$this->dbh_sent->commit();
+		
+			if (!$sth || ($sth && $sth->errorCode() != 0)) {
+				/*  识别错误且回滚更改  */
+				$this->dbh_sent->rollBack();
+				$error = $this->dbh_sent->errorInfo();
+				$this->errorMsg = $error[2];
+				return false;
+			} else {
+				#没错误 添加log 
+				$this->errorMsg = "";
+				return true;
+			}
+		}
+		else{
+			$this->errorMsg = "";
+			return true;
+		}
+	}
+
+	public function insert($arrData){
+		/* 插入新数据 */
+		//查询channel语言
+		if (count($arrData) > 0) {
+			//add_edit_event(_SENT_NEW_, "{$newList[0]["book"]}-{$newList[0]["paragraph"]}-{$newList[0]["begin"]}-{$newList[0]["end"]}@{$newList[0]["channal"]}");
+			$this->dbh_sent->beginTransaction();
+			$query = "INSERT INTO sentence (id,
+											parent,
+											book,
+											paragraph,
+											begin,
+											end,
+											channal,
+											tag,
+											author,
+											editor,
+											text,
+											language,
+											ver,
+											status,
+											strlen,
+											modify_time,
+											receive_time,
+											create_time
+											)
+								VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ? )";
+			$sth = $this->dbh_sent->prepare($query);
+	
+			$channel_info = new Channal();
+	
+			foreach ($arrData as $data) {
+				if($data["id"]==""){
+					$data["id"] = UUID::v4();
+				}
+				
+				$queryChannel = $channel_info->getChannal($data["channal"]);
+				if ($queryChannel == false) {
+					$lang = $data["language"];
+					$status = 10;
+				} else {
+					$lang = $queryChannel["lang"];
+					$status = $queryChannel["status"];
+				}
+				$sth->execute(array($data["id"],
+					isset($data["parent"]) ? $data["parent"] : "",
+					$data["book"],
+					$data["paragraph"],
+					$data["begin"],
+					$data["end"],
+					$data["channal"],
+					isset($data["tag"]) ? $data["tag"] : "",
+					$data["author"],
+					$data["editor"],
+					$data["text"],
+					$lang,
+					1,
+					$status,
+					mb_strlen($data["text"], "UTF-8"),
+					mTime(),
+					mTime(),
+					mTime(),
+				));
+			}
+			$this->dbh_sent->commit();
+	
+			if (!$sth || ($sth && $sth->errorCode() != 0)) {
+				/*  识别错误且回滚更改  */
+				$this->dbh_sent->rollBack();
+				$error = $this->dbh_sent->errorInfo();
+				$this->errorMsg = $error[2];
+				return false;
+			} else {
+				$this->errorMsg = "";
+				return true;
+			}
+		}
+		else{
+			$this->errorMsg = "";
+			return true;
+		}
+	}
+
+	public function send_pr($arrData){
+		if (count($arrData) ==0) {
+			$this->errorMsg = "";
+			return true;
+		}
+		$this->dbh_sent->beginTransaction();
+		$query = "INSERT INTO sent_pr (id,
+							book,
+							paragraph,
+							begin,
+							end,
+							channel,
+							tag,
+							author,
+							editor,
+							text,
+							language,
+							status,
+							strlen,
+							modify_time,
+							receive_time,
+							create_time
+							)
+							VALUES (NULL, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ? )";
+		$stmt = $this->dbh_sent->prepare($query);
+
+		foreach ($arrData as $data) {
+			# 初始状态 1 未处理
+			$stmt->execute(array(
+							$data["book"],
+							$data["para"],
+							$data["begin"],
+							$data["end"],
+							$data["channal"],
+							"",
+							"[]",
+							$data["editor"],
+							$data["text"],
+							$data["language"],
+							1,
+							mb_strlen($data["text"], "UTF-8"),
+							mTime(),
+							mTime(),
+							mTime(),
+							));
+		}
+		$this->dbh_sent->commit();
+		if (!$stmt || ($stmt && $stmt->errorCode() != 0)) {
+			#  识别错误  
+			$this->dbh_sent->rollBack();
+			$error = $this->dbh_sent->errorInfo();
+			$this->errorMsg = $error[2];
+			return false;
+		} else {
+			# 没错误
+			$this->errorMsg = "";
+			return true;
+		}
+	}
+
+	public function historay($arrData)
+	{
+		if (count($arrData) ==0) {
+			$this->errorMsg = "";
+			return true;
+		}
+		$this->dbh_his->beginTransaction();
+		# 更新historay
+		$query = "INSERT INTO sent_historay (sent_id,  user_id,  text,  date, landmark) VALUES (? , ? , ? , ? , ? )";
+		$stmt = $this->dbh_his->prepare($query);
+
+		foreach ($arrData as $data) {
+			$stmt->execute(array($data["id"],
+							$data["editor"],
+							$data["text"],
+							mTime(),
+							$data["landmark"]));
+		}
+		if (!$stmt || ($stmt && $stmt->errorCode() != 0)) {
+			/*  识别错误  */
+			$this->dbh_sent->rollBack();
+			$error = $this->dbh_sent->errorInfo();
+			$this->errorMsg = $error[2];
+			return false;
+		} else {
+			#没错误
+			$this->errorMsg = "";
+			return true;
+		}
+	}
+}

+ 6 - 2
app/usent/sent_post.php

@@ -42,7 +42,7 @@ if (isset($_POST["channal"])) {
 
     if ($fetch) {
         $text_lang = $fetch["lang"];
-        $channel_status = $fetch["status"];
+		$channel_status = $fetch["status"];
     }
     $respond['lang'] = $text_lang;
     if ($fetch && $fetch["owner"] == $_COOKIE["userid"]) {
@@ -51,6 +51,10 @@ if (isset($_POST["channal"])) {
     } else {
 		$sharePower = share_get_res_power($_COOKIE["userid"],$_POST["channal"]);
 		$cooperation = $sharePower;
+		if($channel_status>=30 && $cooperation<10){
+			#全网公开的 可以提交pr
+			$cooperation = 10;
+		}
 		/*
         $query = "SELECT count(*) FROM cooperation WHERE channal_id= ? and user_id=? ";
         $fetch = PDO_FetchOne($query, array($_POST["channal"], $_COOKIE["userid"]));
@@ -77,7 +81,7 @@ if($cooperation==0){
     exit;
 }
 
-PDO_Connect("" . _FILE_DB_SENTENCE_);
+PDO_Connect(_FILE_DB_SENTENCE_);
 
 $_id = false;
 if ((isset($_POST["id"]) && empty($_POST["id"])) || !isset($_POST["id"])) {

+ 1 - 0
app/widget/iframe_modal_win.css

@@ -21,6 +21,7 @@
 	left: 0;
 	right: 0;
 	bottom: 0;
+	overflow-y: scroll;
 	/*
 版权声明:本文为CSDN博主「_吟游诗人」的原创文章,遵循CC 4.0 BY-SA版权协议,转载请附上原文出处链接及本声明。
 原文链接:https://blog.csdn.net/qq_32623363/article/details/77101971

+ 37 - 0
app/widget/iframe_modal_win.js

@@ -38,3 +38,40 @@ function iframe_win_init(param) {
 	});
 	return iframeWin;
 }
+
+/*
+container 容器id
+name=iframe name
+width
+height
+*/
+function model_win_init(param) {
+	let modelWin = new Object();
+	modelWin.container = param.container;
+	modelWin.show = function (html) {
+		$(".modal_win_bg").show();
+		$("#" + modelWin.container).html(html);
+		$("#" + modelWin.container).show();
+	};
+	if (typeof param.onclose != "undefined") {
+		modelWin.onclose = onclose;
+	} else {
+		modelWin.onclose = function () {
+			return 1;
+		};
+	}
+	$("#" + modelWin.container).addClass("iframe_container");
+	if (typeof param.width != "undefined") {
+		$("#" + modelWin.container).css("width", param.width);
+	}
+	if (typeof param.height != "undefined") {
+		$("#" + modelWin.container).css("height", param.height);
+	}
+
+	$(".modal_win_bg").click(function () {
+		$(".modal_win_bg").hide();
+		$(".iframe_container").hide();
+		this.onclose();
+	});
+	return modelWin;
+}

+ 2 - 1
composer.json

@@ -1,5 +1,6 @@
 {
 	"require": {
-		"elasticsearch/elasticsearch": "~7.0"
+		"elasticsearch/elasticsearch": "~7.0",
+		"phpexcel/phpexcel": "dev-master"
 	}
 }

+ 368 - 0
composer.lock

@@ -0,0 +1,368 @@
+{
+    "_readme": [
+        "This file locks the dependencies of your project to a known state",
+        "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies",
+        "This file is @generated automatically"
+    ],
+    "content-hash": "5905e9ae260b85f1aa721b2323c761e0",
+    "packages": [
+        {
+            "name": "elasticsearch/elasticsearch",
+            "version": "v7.11.0",
+            "source": {
+                "type": "git",
+                "url": "https://github.com/elastic/elasticsearch-php.git",
+                "reference": "277cd5e182827c59c23e146a836a30470c0f879d"
+            },
+            "dist": {
+                "type": "zip",
+                "url": "https://api.github.com/repos/elastic/elasticsearch-php/zipball/277cd5e182827c59c23e146a836a30470c0f879d",
+                "reference": "277cd5e182827c59c23e146a836a30470c0f879d",
+                "shasum": "",
+                "mirrors": [
+                    {
+                        "url": "https://mirrors.aliyun.com/composer/dists/%package%/%reference%.%type%",
+                        "preferred": true
+                    }
+                ]
+            },
+            "require": {
+                "ext-json": ">=1.3.7",
+                "ezimuel/ringphp": "^1.1.2",
+                "php": "^7.1 || ^8.0",
+                "psr/log": "~1.0"
+            },
+            "require-dev": {
+                "cpliakas/git-wrapper": "~2.0 || ~3.0",
+                "doctrine/inflector": "^1.3",
+                "ext-yaml": "*",
+                "ext-zip": "*",
+                "mockery/mockery": "^1.2",
+                "phpstan/phpstan": "^0.12",
+                "phpunit/phpunit": "^7.5 || ^8.5 || ^9.3",
+                "squizlabs/php_codesniffer": "^3.4",
+                "symfony/finder": "~4.0",
+                "symfony/yaml": "~4.0"
+            },
+            "suggest": {
+                "ext-curl": "*",
+                "monolog/monolog": "Allows for client-level logging and tracing"
+            },
+            "type": "library",
+            "autoload": {
+                "files": [
+                    "src/autoload.php"
+                ],
+                "psr-4": {
+                    "Elasticsearch\\": "src/Elasticsearch/"
+                }
+            },
+            "notification-url": "https://packagist.org/downloads/",
+            "license": [
+                "Apache-2.0"
+            ],
+            "authors": [
+                {
+                    "name": "Zachary Tong"
+                },
+                {
+                    "name": "Enrico Zimuel"
+                }
+            ],
+            "description": "PHP Client for Elasticsearch",
+            "keywords": [
+                "client",
+                "elasticsearch",
+                "search"
+            ],
+            "support": {
+                "issues": "https://github.com/elastic/elasticsearch-php/issues",
+                "source": "https://github.com/elastic/elasticsearch-php/tree/v7.11.0"
+            },
+            "time": "2021-02-11T11:04:51+00:00"
+        },
+        {
+            "name": "ezimuel/guzzlestreams",
+            "version": "3.0.1",
+            "source": {
+                "type": "git",
+                "url": "https://github.com/ezimuel/guzzlestreams.git",
+                "reference": "abe3791d231167f14eb80d413420d1eab91163a8"
+            },
+            "dist": {
+                "type": "zip",
+                "url": "https://api.github.com/repos/ezimuel/guzzlestreams/zipball/abe3791d231167f14eb80d413420d1eab91163a8",
+                "reference": "abe3791d231167f14eb80d413420d1eab91163a8",
+                "shasum": "",
+                "mirrors": [
+                    {
+                        "url": "https://mirrors.aliyun.com/composer/dists/%package%/%reference%.%type%",
+                        "preferred": true
+                    }
+                ]
+            },
+            "require": {
+                "php": ">=5.4.0"
+            },
+            "require-dev": {
+                "phpunit/phpunit": "~4.0"
+            },
+            "type": "library",
+            "extra": {
+                "branch-alias": {
+                    "dev-master": "3.0-dev"
+                }
+            },
+            "autoload": {
+                "psr-4": {
+                    "GuzzleHttp\\Stream\\": "src/"
+                }
+            },
+            "notification-url": "https://packagist.org/downloads/",
+            "license": [
+                "MIT"
+            ],
+            "authors": [
+                {
+                    "name": "Michael Dowling",
+                    "email": "mtdowling@gmail.com",
+                    "homepage": "https://github.com/mtdowling"
+                }
+            ],
+            "description": "Fork of guzzle/streams (abandoned) to be used with elasticsearch-php",
+            "homepage": "http://guzzlephp.org/",
+            "keywords": [
+                "Guzzle",
+                "stream"
+            ],
+            "support": {
+                "source": "https://github.com/ezimuel/guzzlestreams/tree/3.0.1"
+            },
+            "time": "2020-02-14T23:11:50+00:00"
+        },
+        {
+            "name": "ezimuel/ringphp",
+            "version": "1.1.2",
+            "source": {
+                "type": "git",
+                "url": "https://github.com/ezimuel/ringphp.git",
+                "reference": "0b78f89d8e0bb9e380046c31adfa40347e9f663b"
+            },
+            "dist": {
+                "type": "zip",
+                "url": "https://api.github.com/repos/ezimuel/ringphp/zipball/0b78f89d8e0bb9e380046c31adfa40347e9f663b",
+                "reference": "0b78f89d8e0bb9e380046c31adfa40347e9f663b",
+                "shasum": "",
+                "mirrors": [
+                    {
+                        "url": "https://mirrors.aliyun.com/composer/dists/%package%/%reference%.%type%",
+                        "preferred": true
+                    }
+                ]
+            },
+            "require": {
+                "ezimuel/guzzlestreams": "^3.0.1",
+                "php": ">=5.4.0",
+                "react/promise": "~2.0"
+            },
+            "require-dev": {
+                "ext-curl": "*",
+                "phpunit/phpunit": "~4.0"
+            },
+            "suggest": {
+                "ext-curl": "Guzzle will use specific adapters if cURL is present"
+            },
+            "type": "library",
+            "extra": {
+                "branch-alias": {
+                    "dev-master": "1.1-dev"
+                }
+            },
+            "autoload": {
+                "psr-4": {
+                    "GuzzleHttp\\Ring\\": "src/"
+                }
+            },
+            "notification-url": "https://packagist.org/downloads/",
+            "license": [
+                "MIT"
+            ],
+            "authors": [
+                {
+                    "name": "Michael Dowling",
+                    "email": "mtdowling@gmail.com",
+                    "homepage": "https://github.com/mtdowling"
+                }
+            ],
+            "description": "Fork of guzzle/RingPHP (abandoned) to be used with elasticsearch-php",
+            "support": {
+                "source": "https://github.com/ezimuel/ringphp/tree/1.1.2"
+            },
+            "time": "2020-02-14T23:51:21+00:00"
+        },
+        {
+            "name": "phpexcel/phpexcel",
+            "version": "dev-master",
+            "source": {
+                "type": "git",
+                "url": "https://github.com/ddeboer/phpexcel.git",
+                "reference": "656336f53bcd0d11abba40db6c9f8553d320434c"
+            },
+            "dist": {
+                "type": "zip",
+                "url": "https://api.github.com/repos/ddeboer/phpexcel/zipball/656336f53bcd0d11abba40db6c9f8553d320434c",
+                "reference": "656336f53bcd0d11abba40db6c9f8553d320434c",
+                "shasum": "",
+                "mirrors": [
+                    {
+                        "url": "https://mirrors.aliyun.com/composer/dists/%package%/%reference%.%type%",
+                        "preferred": true
+                    }
+                ]
+            },
+            "require": {
+                "php": ">5.2.0"
+            },
+            "type": "library",
+            "autoload": {
+                "psr-0": {
+                    "PHPExcel": "Classes"
+                }
+            },
+            "notification-url": "https://packagist.org/downloads/",
+            "license": [
+                "GNU"
+            ],
+            "description": "DEPRECATED! Use phpoffice/phpexcel instead.",
+            "homepage": "http://phpexcel.codeplex.com",
+            "support": {
+                "source": "https://github.com/ddeboer/phpexcel/tree/master"
+            },
+            "abandoned": "phpoffice/phpexcel",
+            "time": "2014-02-06T05:54:09+00:00"
+        },
+        {
+            "name": "psr/log",
+            "version": "1.1.3",
+            "source": {
+                "type": "git",
+                "url": "https://github.com/php-fig/log.git",
+                "reference": "0f73288fd15629204f9d42b7055f72dacbe811fc"
+            },
+            "dist": {
+                "type": "zip",
+                "url": "https://api.github.com/repos/php-fig/log/zipball/0f73288fd15629204f9d42b7055f72dacbe811fc",
+                "reference": "0f73288fd15629204f9d42b7055f72dacbe811fc",
+                "shasum": "",
+                "mirrors": [
+                    {
+                        "url": "https://mirrors.aliyun.com/composer/dists/%package%/%reference%.%type%",
+                        "preferred": true
+                    }
+                ]
+            },
+            "require": {
+                "php": ">=5.3.0"
+            },
+            "type": "library",
+            "extra": {
+                "branch-alias": {
+                    "dev-master": "1.1.x-dev"
+                }
+            },
+            "autoload": {
+                "psr-4": {
+                    "Psr\\Log\\": "Psr/Log/"
+                }
+            },
+            "notification-url": "https://packagist.org/downloads/",
+            "license": [
+                "MIT"
+            ],
+            "authors": [
+                {
+                    "name": "PHP-FIG",
+                    "homepage": "http://www.php-fig.org/"
+                }
+            ],
+            "description": "Common interface for logging libraries",
+            "homepage": "https://github.com/php-fig/log",
+            "keywords": [
+                "log",
+                "psr",
+                "psr-3"
+            ],
+            "support": {
+                "source": "https://github.com/php-fig/log/tree/1.1.3"
+            },
+            "time": "2020-03-23T09:12:05+00:00"
+        },
+        {
+            "name": "react/promise",
+            "version": "v2.8.0",
+            "source": {
+                "type": "git",
+                "url": "https://github.com/reactphp/promise.git",
+                "reference": "f3cff96a19736714524ca0dd1d4130de73dbbbc4"
+            },
+            "dist": {
+                "type": "zip",
+                "url": "https://api.github.com/repos/reactphp/promise/zipball/f3cff96a19736714524ca0dd1d4130de73dbbbc4",
+                "reference": "f3cff96a19736714524ca0dd1d4130de73dbbbc4",
+                "shasum": "",
+                "mirrors": [
+                    {
+                        "url": "https://mirrors.aliyun.com/composer/dists/%package%/%reference%.%type%",
+                        "preferred": true
+                    }
+                ]
+            },
+            "require": {
+                "php": ">=5.4.0"
+            },
+            "require-dev": {
+                "phpunit/phpunit": "^7.0 || ^6.5 || ^5.7 || ^4.8.36"
+            },
+            "type": "library",
+            "autoload": {
+                "psr-4": {
+                    "React\\Promise\\": "src/"
+                },
+                "files": [
+                    "src/functions_include.php"
+                ]
+            },
+            "notification-url": "https://packagist.org/downloads/",
+            "license": [
+                "MIT"
+            ],
+            "authors": [
+                {
+                    "name": "Jan Sorgalla",
+                    "email": "jsorgalla@gmail.com"
+                }
+            ],
+            "description": "A lightweight implementation of CommonJS Promises/A for PHP",
+            "keywords": [
+                "promise",
+                "promises"
+            ],
+            "support": {
+                "issues": "https://github.com/reactphp/promise/issues",
+                "source": "https://github.com/reactphp/promise/tree/v2.8.0"
+            },
+            "time": "2020-05-12T15:16:56+00:00"
+        }
+    ],
+    "packages-dev": [],
+    "aliases": [],
+    "minimum-stability": "stable",
+    "stability-flags": {
+        "phpexcel/phpexcel": 20
+    },
+    "prefer-stable": false,
+    "prefer-lowest": false,
+    "platform": [],
+    "platform-dev": [],
+    "plugin-api-version": "2.0.0"
+}