瀏覽代碼

新建译文的时候 句子继承channel 语言 和 公开状态

visuddhinanda 5 年之前
父節點
當前提交
72e0048b6f
共有 5 個文件被更改,包括 31 次插入12 次删除
  1. 1 2
      app/course/index.php
  2. 9 0
      app/public/php/define.php
  3. 0 4
      app/public/php/test_dir.php
  4. 4 2
      app/usent/sent_post.php
  5. 17 4
      app/usent/update.php

+ 1 - 2
app/course/index.php

@@ -248,8 +248,7 @@ include "../pcdl/html_head.php";
 					html += '<div class="course_right">';
 					html += '<div class="title"><a href="../course/course.php?id=' + iterator.id + '">' + iterator.title + '</a></div>';
 
-					//協助補上代碼:
-
+					//教师名字
 					html += '<div class="author">'+gLocal.gui.speaker+':';
 					html += "<a href='../uhome/course.php?userid="+iterator.teacher+"'>"
 					html += iterator.teacher_info.nickname;

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

@@ -0,0 +1,9 @@
+<?PHP
+# 内容的可见性,应用于文集,用户译文等 当有些内容不适合删除时,disable 代替 deleted
+define("_CONTENT_VISIBILITY_DELETED_" , -1);
+define("_CONTENT_VISIBILITY_DISABLE_" , 0);
+define("_CONTENT_VISIBILITY_PRIVATE_" , 10);
+define("_CONTENT_VISIBILITY_UNLISTED_" , 20);
+define("_CONTENT_VISIBILITY_PUBLIC_" , 30);
+
+?>

+ 0 - 4
app/public/php/test_dir.php

@@ -1,4 +0,0 @@
-<?php 
-echo __dir__;
-echo $_SERVER['DOCUMENT_ROOT'];
-?>

+ 4 - 2
app/usent/sent_post.php

@@ -32,13 +32,15 @@ $respond['editor']=$_COOKIE["userid"];
 #先查询对此channal是否有权限修改
 $cooperation = 0;
 $text_lang = "en";
+$channel_status = 0;
 if(isset($_POST["channal"])){
    PDO_Connect("sqlite:"._FILE_DB_CHANNAL_);
-    $query = "SELECT owner, lang FROM channal WHERE id=?";
+    $query = "SELECT owner, lang , status FROM channal WHERE id=?";
     $fetch = PDO_FetchRow($query,array($_POST["channal"]));
     
     if($fetch){
         $text_lang = $fetch["lang"];
+        $channel_status = $fetch["status"];
     }
     $respond['lang']=$text_lang;
     if($fetch && $fetch["owner"]==$_COOKIE["userid"]){
@@ -122,7 +124,7 @@ else{
                                 $_POST["text"],
                                 $text_lang ,
                                 1,
-                                7,
+                                $channel_status,
                                 mb_strlen($_POST["text"],"UTF-8"),
                                 mTime(),
                                 mTime(),

+ 17 - 4
app/usent/update.php

@@ -6,6 +6,7 @@ require_once "../path.php";
 require_once "../public/_pdo.php";
 require_once "../public/function.php";
 require_once "../usent/function.php";
+require_once "../channal/function.php";
 require_once "../ucenter/active.php";
 
 #检查是否登陆
@@ -130,14 +131,26 @@ if(count($newList)>0){
 						VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ? )";
 	$sth = $PDO->prepare($query);
 
+	$channel_info = new Channal();
+
 	foreach ($newList as $data) {
 			$uuid = UUID::v4();
-			if($data["parent"]){
+			if(isset($data["parent"])){
 				$parent = $data["parent"];
 			}
 			else{
 				$parent  = "";
 			}
+
+			$queryChannel = $channel_info->getChannal($data["channal"]);
+			if($queryChannel == false){
+				$lang = $data["language"];
+				$status = 10;
+			}
+			else{
+				$lang = $queryChannel["lang"];
+				$status = $queryChannel["status"];
+			}
 			$sth->execute(array($uuid,
 						$parent,
 						$data["book"], 
@@ -145,13 +158,13 @@ if(count($newList)>0){
 						$data["begin"], 
 						$data["end"], 
 						$data["channal"], 
-						$data["tag"], 
+						isset($data["tag"])? $data["tag"]:"", 
 						$data["author"], 
 						$_COOKIE["userid"],
 						$data["text"],
-						$data["language"],
+						$lang,
 						1,
-						7,
+						$status,
 						mb_strlen($data["text"],"UTF-8"),
 						mTime(),
 						mTime(),